title: g++ Bug with Partial Template Specialization
body: <p>I am writing some TMP-heavy code for g++ (version 4.8.1_1, Macports) and clang++ (version 3.3, Macports). While g++ rejects the following code listing with <strong>UNBRIDLED FURY</strong>, clang++ compiles it with <em>grace</em> and <em>splendor</em>.</p>
  
  <ul>
  <li>Which complier is in the right? (I strongly suspect it's g++, but I want to get some reassurance from others before submitting a bug report.)</li>
  <li>Do you have any easy or elegant workarounds to suggest? (I need to use template aliases, so switching over to structs, which causes g++ to accept the code, is not an option.)</li>
  </ul>
  
  <p>Here is the code listing, made <em>just for you</em>.</p>
  
  <pre><code>template &lt;class... Ts&gt;
  struct sequence;
  
  template &lt;int T&gt;
  struct integer;
  
  // This definition of `extents` causes g++ to issue a compile-time error.
  template &lt;int... Ts&gt;
  using extents = sequence&lt;integer&lt;Ts&gt;...&gt;;
  
  // However, this definition works without any problems.
  // template &lt;int... Ts&gt;
  // struct extents;
  
  template &lt;int A, int B, class Current&gt;
  struct foo;
  
  template &lt;int A, int B, int... Ts&gt;
  struct foo&lt;A, B, extents&lt;Ts...&gt;&gt;
  {
      using type = int;
  };
  
  template &lt;int B, int... Ts&gt;
  struct foo&lt;B, B, extents&lt;Ts...&gt;&gt;
  {
      using type = int;
  };
  
  int main()
  {
      using t = foo&lt;1, 1, extents&lt;&gt;&gt;::type;
      return 0;
  }
  </code></pre>
  
  <p>Here is g++'s output:</p>
  
  <pre><code>er.cpp: In function 'int main()':
  er.cpp:39:41: error: ambiguous class template instantiation for 'struct foo&lt;1, 1, sequence&lt;&gt; &gt;'
    using t = typename foo&lt;1, 1, extents&lt;&gt;&gt;::type;
                                           ^
  er.cpp:26:8: error: candidates are: struct foo&lt;A, B, sequence&lt;integer&lt;Ts&gt;...&gt; &gt;
   struct foo&lt;A, B, extents&lt;Ts...&gt;&gt;
          ^
  er.cpp:32:8: error:                 struct foo&lt;B, B, sequence&lt;integer&lt;Ts&gt;...&gt; &gt;
   struct foo&lt;B, B, extents&lt;Ts...&gt;&gt;
          ^
  er.cpp:39:43: error: 'type' in 'struct foo&lt;1, 1, sequence&lt;&gt; &gt;' does not name a type
    using t = typename foo&lt;1, 1, extents&lt;&gt;&gt;::type;
                                             ^
  </code></pre>
  
  <p>Here is clang++'s output:</p>
  
  <p>Thanks for your help!</p>