https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96213
--- Comment #2 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> --- Here's a similar situation I just ran into again, somehow! // https://godbolt.org/z/3TKG1z struct S {}; template<class = decltype(S(42), void())> void f() {} template<int I=42, class = decltype(S(I), void())> void g() {} int main() { f(); // correctly errors out g(); // incorrectly accepted by GCC } GCC is happy to treat `S(I)` as well-formed when `I` is a template parameter. Obviously `decltype(S(I), void())` can't be anything because `S(I)` is ill-formed, so I'm not sure what GCC is doing to compile this.