Index: clang/lib/Sema/TreeTransform.h =================================================================== --- clang/lib/Sema/TreeTransform.h +++ clang/lib/Sema/TreeTransform.h @@ -4569,7 +4569,7 @@ getSema(), Uneval ? Sema::ExpressionEvaluationContext::Unevaluated : Sema::ExpressionEvaluationContext::ConstantEvaluated, - /*LambdaContextDecl=*/nullptr, /*ExprContext=*/ + Sema::ReuseLambdaContextDecl, /*ExprContext=*/ Sema::ExpressionEvaluationContextRecord::EK_TemplateArgument); Expr *InputExpr = Input.getSourceExpression(); Index: clang/test/SemaTemplate/concepts-lambda.cpp =================================================================== --- clang/test/SemaTemplate/concepts-lambda.cpp +++ clang/test/SemaTemplate/concepts-lambda.cpp @@ -1,6 +1,5 @@ // RUN: %clang_cc1 -std=c++20 -verify %s // RUN: %clang_cc1 -std=c++20 -verify %s -triple powerpc64-ibm-aix -// expected-no-diagnostics namespace GH57945 { template @@ -92,3 +91,28 @@ static_assert(ConstructibleWithN); } + +// GH60642 reported an assert being hit, make sure we don't assert. +namespace GH60642 { +template concept C = requires { Q.template operator()(); }; +template concept D = true; +static_assert(C<[]{}>); // ok +template concept E = C<[]{}>; +static_assert(E); // previously Asserted. + +// ensure we properly diagnose when "D" is false. +namespace DIsFalse { +template concept C = requires { Q.template operator()(); }; +template concept D = false; +static_assert(C<[]{}>); +// expected-error@-1{{static assertion failed}} +// expected-note@-2{{does not satisfy 'C'}} +// expected-note@-5{{because 'Q.template operator()()' would be invalid: no matching member function for call to 'operator()'}} +template concept E = C<[]{}>; +static_assert(E); +// expected-error@-1{{static assertion failed}} +// expected-note@-2{{because 'int' does not satisfy 'E'}} +// expected-note@-4{{does not satisfy 'C'}} +// expected-note@-11{{because 'Q.template operator()()' would be invalid: no matching member function for call to 'operator()'}} +} +}