title: Template alias visibility in nested class
body: <p>Consider the following:</p>
  
  <pre><code>template&lt;typename X&gt;
  struct Z {};
  
  struct A
  {
      using Z = ::Z&lt;int&gt;;
  
      struct B : Z
      {
          using C = Z;
      };
  };
  </code></pre>
  
  <p>This compiles fine. Nice. But now add another parameter in <code>Z</code>:</p>
  
  <pre><code>template&lt;typename X, typename Y&gt;
  struct Z {};
  
  struct A
  {
      template&lt;typename X&gt;
      using Z = ::Z&lt;X, int&gt;;
  
      struct B : Z&lt;B&gt;
      {
          using C = Z&lt;B&gt;;  // error: too few template arguments for class template 'Z'
      };
  };
  </code></pre>
  
  <p>Ok, maybe it makes sense that the definition of template alias <code>Z</code> in class <code>A</code> is visible when deriving nested class <code>B</code>, but not inside its body, triggering the error since the global definition of <code>Z</code> has two parameters.</p>
  
  <p>But <strong>why</strong> is the behavior different in the first case, when <code>Z</code> is just a type alias in <code>A</code>?</p>
  
  <p>Finally, make <code>A</code> a template:</p>
  
  <pre><code>template&lt;typename X, typename Y&gt;
  struct Z {};
  
  template&lt;typename T&gt;
  struct A
  {
      template&lt;typename X&gt;
      using Z = ::Z&lt;X, int&gt;;
  
      struct B : Z&lt;B&gt;
      {
          using C = Z&lt;B&gt;;
      };
  };
  </code></pre>
  
  <p>Now the error is gone. <strong>Why?</strong></p>
  
  <p>(Tested on Clang 3.6 and GCC 4.9.2)</p>