gcc trunk with -std=c++20 rejects this example as having no matching function call: template <auto V1 = []{ return 0; }> struct s { template <auto V2 = []{ return 1; }> int foo() { return 0; } }; int main() { return s{}.foo(); } gcc accepts if: * foo()'s default argument is 1 instead of a lambda * s is not a class template (but changing V1's default to be 0 while keeping V2 as a lambda is still an error)
Confirmed. Here is another example: template <auto V1 = 0> struct s { template <auto V2 = []{ return 1; }> int foo() { return 0; } }; int main() { s a{}; return a.foo(); } ---- CUT ---- Note the original example causes clang to ICE :) while this one is accepted.
Dup of bug 93595. *** This bug has been marked as a duplicate of bug 93595 ***