https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67332
Bug ID: 67332
Summary: [C++11] g++ rejects expansion of multiple parameter
packs
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: miyuki at gcc dot gnu.org
Target Milestone: ---
Consider the following code:
$ cat test2.cc
template<typename... Args>
struct Typelist { };
template<typename... InvokableArgs, typename... Rest>
void foo (Typelist<InvokableArgs...>, Typelist<Rest...>, InvokableArgs&&...,
Rest&&...) { }
void bar()
{
foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
}
GCC 6 rejects it:
$ g++ -c test2.cc
test2.cc: In function 'void bar()':
test2.cc:9:53: error: no matching function for call to 'foo(Typelist<double>,
Typelist<int>, double, int)'
foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
^
test2.cc:5:6: note: candidate: template<class ... InvokableArgs, class ...
Rest> void foo(Typelist<InvokableArgs ...>, Typelist<Rest ...>, InvokableArgs&&
..., Rest&& ...)
void foo (Typelist<InvokableArgs...>, Typelist<Rest...>, InvokableArgs&&...,
Rest&&...) { }
^
test2.cc:5:6: note: template argument deduction/substitution failed:
test2.cc:9:53: note: inconsistent parameter pack deduction with '' and ''
foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
Clang 3.7 accepts the code, but EDG also rejects:
$ /opt/intel/bin/icpc -std=c++11 -c test2.cc
test2.cc(9): error: no instance of function template "foo" matches the argument
list
argument types are: (Typelist<double>, Typelist<int>, double, int)
foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
^
compilation aborted for test2.cc (code 2)
Although I'm not sure, whether the code is valid or not, at least the
diagnostic is somewhat confusing.