https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106629
Bug ID: 106629
Summary: GCC accepts invalid program involving {1,2,3,4} as
template argument
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 invalid program is accepted by gcc.
https://godbolt.org/z/Mb3qbvvPz
```
struct Impl
{
constexpr Impl(std::initializer_list<int>)
{
}
};
struct Bar{};
template<typename T, Impl impl>
struct Foo
{
};
int main()
{
constexpr Foo<Bar, {1,2,3,4}> foo; //works in msvc & gcc but rejected in
clang
return 0;
}
```
The program is invalid because `{1,2,3,4}` cannot be a template argument.