// { dg-do compile { target c++20 } } // ill-formed, no diagnostic required: the two expressions are // functionally equivalent but not equivalent template void foo(const char (&s)[([]{}, N)]); template void foo(const char (&s)[([]{}, N)]); // two different declarations because the non-dependent portions are not // considered equivalent template void spam(decltype([]{}) (*s)[sizeof(T)]); template void spam(decltype([]{}) (*s)[sizeof(T)]); template using A = decltype([] { }); // A and A refer to different closure types template auto f(T) -> decltype([]() { T::invalid; } ()); // { dg-error "invalid" } void f(...); template // { dg-error "invalid" } void g(T); void g(...); template auto h(T) -> decltype([x = T::invalid]() { }); void h(...); template auto i(T) -> decltype([]() -> typename T::invalid { }); void i(...); template auto j(T t) -> decltype([](auto x) -> decltype(x.invalid) { } (t)); void j(...); template struct different {}; template struct different { typename T::invalid t; }; template struct same; template struct same {}; int main() { foo<1>(""); // { dg-error "ambiguous" } spam(nullptr); // { dg-error "ambiguous" } different,A>(); same,A>(); f(0); // error: invalid expression not part of the immediate context g(0); // error: invalid expression not part of the immediate context h(0); // error: invalid expression not part of the immediate context i(0); // error: invalid expression not part of the immediate context j(0); // deduction fails on #1, calls #2 }