title: Template implicit instantiation occurs before using it
body: <p>I've got a question about instantiation of templates. I thought that the template imlicit instantiation occurs when it's required. Let's look at the followin example:</p>
  
  <pre><code>template&lt;typename T&gt;
  struct Base{
      void test();
  };
  
  template &lt;typename T&gt; void Base&lt;T&gt;::test(){ }
  
  template&lt;typename T&gt;
  struct Derived : Base&lt;T&gt;{
      void derived();
  };
  
  template &lt;typename T&gt; void Derived&lt;T&gt;::derived(){ test(); }
  </code></pre>
  
  <p><a href="http://coliru.stacked-crooked.com/a/8c6ab39de2f8e701" rel="nofollow">http://coliru.stacked-crooked.com/a/8c6ab39de2f8e701</a></p>
  
  <p>This code doesn't compile. I thought the existence of <code>test</code> should be checked  only when explicitly or implicitly instantiating like in the following example:</p>
  
  <pre><code>template&lt;typename T&gt;
  struct Derived{
      void derived();
  };
  
  template &lt;typename T&gt; void Derived&lt;T&gt;::derived(){ T::test(); }  //fine
  </code></pre>