title: Deduction guides and variadic class templates with variadic template constructors - mismatched argument pack lengths
body: <p>Consider the following <code>class</code> definition and <a href="http://en.cppreference.com/w/cpp/language/class_template_deduction" rel="noreferrer"><em>deduction guide</em></a>:</p>
  
  <pre><code>template &lt;typename... Ts&gt;
  struct foo : Ts...
  {
      template &lt;typename... Us&gt;
      foo(Us&amp;&amp;... us) : Ts{us}... { }
  };
  
  template &lt;typename... Us&gt;
  foo(Us&amp;&amp;... us) -&gt; foo&lt;Us...&gt;;
  </code></pre>
  
  <hr>
  
  <p>If I try to instantiate <code>foo</code> with explicit <em>template arguments</em>, the code compiles correctly:</p>
  
  <pre><code>foo&lt;bar&gt; a{bar{}}; // ok
  </code></pre>
  
  <hr>
  
  <p>If I try to instantiate <code>foo</code> through the <em>deduction guide</em>...</p>
  
  <pre><code>foo b{bar{}};
  </code></pre>
  
  <ul>
  <li><p>g++7 produces a compiler error:</p>
  
  <pre><code>prog.cc: In instantiation of 'foo&lt;Ts&gt;::foo(Us ...) [with Us = {bar}; Ts = {}]':
  prog.cc:15:16:   required from here
  prog.cc:5:27: error: mismatched argument pack lengths while expanding 'Ts'
       foo(Us... us) : Ts{us}... { }
                             ^~~
  </code></pre></li>
  <li><p>clang++5 explodes:</p>
  
  <pre><code>#0 0x0000000001944af4 PrintStackTraceSignalHandler(void*) (/opt/wandbox/clang-head/bin/clang-5.0+0x1944af4)
  #1 0x0000000001944dc6 SignalHandler(int) (/opt/wandbox/clang-head/bin/clang-5.0+0x1944dc6)
  #2 0x00007fafb639a390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
  #3 0x0000000003015b30 clang::Decl::setDeclContext(clang::DeclContext*) (/opt/wandbox/clang-head/bin/clang-5.0+0x3015b30)
  ...
  clang-5.0: error: unable to execute command: Segmentation fault
  </code></pre></li>
  </ul>
  
  <p><a href="https://wandbox.org/permlink/10ww5p9r9ZOT5hJi" rel="noreferrer"><strong>live example on wandbox</strong></a></p>
  
  <p>While clang++ is definitely bugged <em>(reported as issue <a href="https://bugs.llvm.org//show_bug.cgi?id=32673" rel="noreferrer">#32673</a>)</em>, is g++ correct in rejecting my code? <strong>Is my code ill-formed?</strong> </p>