https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91247

            Bug ID: 91247
           Summary: Variadic template expansion - Mistmatch argument pack
                    length
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mariogalindoq at hotmail dot com
  Target Milestone: ---

Created attachment 46624
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46624&action=edit
Full program that do not compile in gcc due to this bug.

When expanding the pack of a variadic template, the compiler adds an extra
spirous type.

The program can be executed here:

https://wandbox.org/permlink/O1mixn6gm1XWH6Hr


The following is a complete program example that do not compile in gcc but
compile in clang, for instance:


#include <iostream>

template<typename... Lambda_types>
struct S : Lambda_types...
{
// The following only works with clang. In gcc do not compile, this a bug.
  template<typename... T>
  S(T&&... lambda_args) : Lambda_types{std::forward<T>(lambda_args)}... {} //
Mistmach argument pack length !!!
  using Lambda_types::operator()...;
};

template<typename... Lambda_types>
S(Lambda_types...) -> S<Lambda_types...>;

int main()
{
  auto l1 = []()      {return 4;};
  auto l2 = [](int i) {return i*11;};
  S comb{l1,l2};

  std::cout << comb() << '\n';
  std::cout << comb(5) << '\n';
}

// This bug can be relationed with bug id 88580

Reply via email to