title: Template partial specialisation
body: <p>Can somebody explain why are those two specializations indistinguishable to the compiler (gcc 4.5.1 @ ideone)</p>
  
  <p><a href="http://ideone.com/9tNux" rel="noreferrer">http://ideone.com/9tNux</a></p>
  
  <pre><code>template &lt;typename... T&gt; struct S;
  
  template&lt;typename A, typename B, typename... C&gt;
  struct S&lt;A, B, C...&gt; {
     int f() {return 1;}
  };
  
  template&lt;typename... A, typename... C&gt;
  struct S&lt; S&lt;A...&gt;, C...&gt; {
     int f() {return 2;}
  };
  </code></pre>
  
  <p>and when I try to instantiate  <code>S&lt;S&lt;a, b&gt;, a, b&gt; o2;</code> compiler complains:</p>
  
  <pre><code>prog.cpp:20:21: error: ambiguous class template instantiation for 'struct S&lt;S&lt;a, b&gt;, a, b&gt;'
  prog.cpp:6:22: error: candidates are: struct S&lt;A, B, C ...&gt;
  prog.cpp:11:33: error:                 struct S&lt;S&lt;A ...&gt;, C ...&gt;
  prog.cpp:20:21: error: aggregate 'S&lt;S&lt;a, b&gt;, a, b&gt; o2' has incomplete type and cannot be defined
  </code></pre>
  
  <p>And when the last specialization is changed to:</p>
  
  <pre><code>template&lt;typename... A, typename B, typename... C&gt;
  struct S&lt; S&lt;A...&gt;, B, C...&gt; {
     int f() {return 2;}
  }
  </code></pre>
  
  <p>everything works fine.</p>