title: Variadic template as template parameter: deduction works with GCC but not with Clang
body: <p>While compiling some C++11 code with both GCC 4.7.2 and Clang 3.1, I ran into a problem with Clang not managing to deduce a template argument where GCC succeeds.
  In a more abstract form, the code looks like this:</p>
  
  <p>src/test.cc:</p>
  
  <pre><code>struct Element {
  };
  
  template &lt;typename T&gt;
  struct FirstContainer {
  };
  
  template &lt;typename T, typename U = Element&gt;
  struct SecondContainer {
  };
  
  template &lt;template &lt;typename&gt; class Container&gt;
  void processOrdinary(Container&lt;Element&gt; /*elements*/) {
  }
  
  template &lt;template &lt;typename, typename&gt; class Container&gt;
  void processOrdinary(Container&lt;Element, Element&gt; /*elements*/) {
  }
  
  template &lt;template &lt;typename, typename...&gt; class Container&gt;
  void processVariadic(Container&lt;Element&gt; /*elements*/) {
  }
  
  int main() {
    // This function instantiation works in both GCC and Clang.
    processOrdinary(FirstContainer&lt;Element&gt;{});
    // This function instantiation works in both GCC and Clang.
    processOrdinary(SecondContainer&lt;Element&gt;{});
    // This function instantiation works in both GCC and Clang.
    processVariadic(FirstContainer&lt;Element&gt;{});
    // This function instantiation works in both GCC and Clang.
    processVariadic&lt;SecondContainer&gt;(SecondContainer&lt;Element&gt;{});
    // This function instantiation works in GCC but not in Clang.
    processVariadic(SecondContainer&lt;Element&gt;{});
    return 0;
  }
  </code></pre>
  
  <p>From reading the examples in §14.3.3 and the specifications in §14.8.2 of the standard I think the deduction should work, but I can not say for sure. This is the output I get from building:</p>
  
  <pre><code>mkdir -p build-gcc/
  g++ -std=c++0x -W -Wall -Wextra -Weffc++ -pedantic -c -o build-gcc/test.o src/test.cc
  g++  -o build-gcc/test build-gcc/test.o
  mkdir -p build-clang/
  clang++ -std=c++11 -Weverything -Wno-c++98-compat -c -o build-clang/test.o src/test.cc
  src/test.cc:34:3: error: no matching function for call to 'processVariadic'
    processVariadic(SecondContainer&lt;Element&gt;{});
    ^~~~~~~~~~~~~~~
  src/test.cc:21:6: note: candidate template ignored: failed template argument deduction
  void processVariadic(Container&lt;Element&gt; /*elements*/) {
       ^
  1 error generated.
  make: *** [build-clang/test.o] Fel 1
  </code></pre>
  
  <p>Why do the results differ? Is GCC sloppy, Clang dumb, does my code contain unspecified behavior or all of them?</p>