title: parameter packs not expanded with ‘...' -- another variadic template bug with gcc?
body: <p>gcc's treatment of variadic templates is well known to be patchy (see for example <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51253" rel="nofollow">this</a> and <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47226" rel="nofollow">this</a>), but I wonder whether the following bug is already known (I cannot find it at bugzilla) or whether it is indeed a bug. Essentially, gcc (4.8.1) fails to expand a parameter pack inside a lambda:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;algorithm&gt;
  #include &lt;type_traits&gt;
  
  template&lt;typename T, typename F, typename... X&gt;
  void bar(std::vector&lt;T&gt; const&amp;c, F const&amp;f, X&amp;&amp;... x)
  {
    std:for_each(c.begin(),c.end(),[&amp;](const T&amp;t)
           { f(t,std::forward&lt;X&gt;(x)...); });
  }
  </code></pre>
  
  <p>this causes (even without any instantiation)</p>
  
  <pre><code>error: parameter packs not expanded with ‘...’:
    { f(t,std::forward&lt;X&gt;(x)...); });
                          ^
  </code></pre>
  
  <p>any idea how to avoid that? (note: okay with icpc 14.0.2 and clang 3.4) Or is gcc correct after all and clang &amp; icpc wrong?</p>
  
  <p><em>edit</em> Note that the problem is the lambda, as also this doesn't compile:</p>
  
  <pre><code>template&lt;typename T, typename F, typename... X&gt;
  void bar(std::vector&lt;T&gt; const&amp;c, F const&amp;f, X&amp;&amp;... x)
  {
  auto func = [&amp;](const T&amp;t){ f(t,std::forward&lt;X&gt;(x)...); };
  std:for_each(c.begin(),c.end(),func);
  }
  </code></pre>
  
  <p>with the "error" report in the lambda defiition.</p>