[Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion
jlame646 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Oct 1 17:05:30 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107111
Bug ID: 107111
Summary: GCC accepts invalid program involving function
declaration with pack expansion
Product: gcc
Version: 12.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlame646 at gmail dot com
Target Milestone: ---
The following program is incorrectly accepted by gcc. Demo:
https://godbolt.org/z/rvfqzo5YW
```
template<typename T, typename... V>
struct C
{
T v(V()...);;
};
int main()
{
C<int> c; //works with gcc but rejected in clang
C<int, double, int, int> c2; //same here: works with gcc but rejected in
clang
}
```
This is invalid because the construct `V()...` is actually equivalent to
`V(),...`. So `V` is not expanded and this must be rejected.
More information about the Gcc-bugs
mailing list