// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s // expected-no-diagnostics template constexpr bool is_same_v = false; template constexpr bool is_same_v = true; template concept is_same = is_same_v; template struct X {}; template concept C1 = is_same>; template X>> t1() { return [](T2) -> X> { struct S { static X> f() { return [](T3) -> X { static_assert(is_same>); static_assert(is_same>); return X(); }(X()); } }; return S::f(); }(X()); }; template X>> t1(); #if 0 // FIXME: crashes template auto t2() { return [](T2) { struct S { static auto f() { return [](T3) { static_assert(is_same>); static_assert(is_same>); return X(); }(X()); } }; return S::f(); }(X()); }; template auto t2(); static_assert(is_same()), X>>>); template C1>> auto t3() { return [] T2>(T2) -> C1> auto { struct S { static auto f() { return [] T3>(T3) -> C1 auto { return X(); }(X()); } }; return S::f(); }(X()); }; template C1>> auto t3(); static_assert(is_same()), X>>>); #endif namespace GH95735 { int g(int fn) { return [f = fn](auto tpl) noexcept(noexcept(f)) { return f; }(0); } int foo(auto... fn) { // FIXME: This one hits the assertion "if the exception specification is dependent, // then the noexcept expression should be value-dependent" in the constructor of // FunctionProtoType. // One possible solution is to update Sema::canThrow() to consider expressions // (e.g. DeclRefExpr/FunctionParmPackExpr) involving unexpanded parameters as Dependent. // This would effectively add an extra value-dependent flag to the noexcept expression. // However, I'm afraid that would also cause ABI breakage. // [...f = fn](auto tpl) noexcept(noexcept(f)) { return 0; }(0); [...f = fn](auto tpl) noexcept(noexcept(g(fn...))) { return 0; }(0); return [...f = fn](auto tpl) noexcept(noexcept(g(f...))) { return 0; }(0); } int v = foo(42); } // namespace GH95735