title: Is it legal to use an unexpanded parameter pack as the type of a template template parameter's non-type template parameter?
body: <p>gcc and clang disagree about whether the following code should compile:</p>
  <pre><code>template &lt;typename... Args&gt;
  struct tuple {};
  
  template &lt;typename&gt;
  struct Test;
  
  template &lt;
      typename... Types,
      template &lt;Types&gt; typename... Outer, // XXX
      Types... Inner
  &gt;
  struct Test&lt;tuple&lt;Outer&lt;Inner&gt;...&gt;&gt; {};
  
  template &lt;long T&gt; struct O1 {};
  template &lt;unsigned T&gt; struct O2 {};
  
  Test&lt;tuple&lt;O1&lt;1&gt;, O2&lt;2&gt;&gt;&gt; test;
  </code></pre>
  <p>clang accepts the code, deducing <code>Types = {long, unsigned}, Outer = {O1, O2}, Inner={1L, 2U}</code>. Structurally, this seems correct.</p>
  <p>gcc rejects the code with a deduction failure. Interestingly, it <em>does</em> accept if <code>O2</code> is changed to take a <code>long</code> non-type template parameter, which seems inconsistent to me. It suggests that Types can be expanded if <code>Types = {long, long}</code> but not if <code>Types = {long, unsigned}</code>.</p>
  <p>However, it's not clear to me from the standard which compiler is correct. The core question is: on the line denoted <code>XXX</code>, is it valid to have a parameter pack as the type of the template template parameter's non-type template parameter? Should it expand the way that clang claims it does?</p>