https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107113
Bug ID: 107113
Summary: In function parameter list, `...` expanding a pack is
accepted after `()` of a parameter declarator, but not
before
Product: gcc
Version: 12.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iamsupermouse at mail dot ru
Target Milestone: ---
GCC rejects this code:
template <typename ...P>
struct A
{
void Foo(P...());
};
A<int, int> a;
But accepts this:
template <typename ...P>
struct A
{
void Foo(P()...);
};
A<int, int> a;
Only the first snippet should compile, since `...` must be located immediately
before a parameter name (or a place where it would otherwise be located), as
commonly seen in cases like `X &&... x`.
Clang only accepts the first snippet.