diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -41,9 +41,11 @@ LHS = BO->getLHS(); RHS = BO->getRHS(); } else if (auto *OO = dyn_cast(E)) { - Op = OO->getOperator(); - LHS = OO->getArg(0); - RHS = OO->getArg(1); + if(OO->getNumArgs() == 2) { + Op = OO->getOperator(); + LHS = OO->getArg(0); + RHS = OO->getArg(1); + } } } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -16657,8 +16657,8 @@ if (!Rec.Lambdas.empty()) { using ExpressionKind = ExpressionEvaluationContextRecord::ExpressionKind; - if (Rec.ExprContext == ExpressionKind::EK_TemplateArgument || Rec.isUnevaluated() || - (Rec.isConstantEvaluated() && !getLangOpts().CPlusPlus17)) { + if (!getLangOpts().CPlusPlus20 && (Rec.ExprContext == ExpressionKind::EK_TemplateArgument || Rec.isUnevaluated() || + (Rec.isConstantEvaluated() && !getLangOpts().CPlusPlus17))) { unsigned D; if (Rec.isUnevaluated()) { // C++11 [expr.prim.lambda]p2: diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-unevaluated.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-unevaluated.cpp new file mode 100644 --- /dev/null +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-unevaluated.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c++20 %s -verify +// expected-no-diagnostics + +template struct Nothing {}; + +template +concept True = [] { return true; }(); + +static_assert(True); + +using x = decltype([] { return 0;}()); + +Nothing<[]() { return 0; }()> nothing; diff --git a/clang/test/SemaCXX/anonymous-struct.cpp b/clang/test/SemaCXX/anonymous-struct.cpp --- a/clang/test/SemaCXX/anonymous-struct.cpp +++ b/clang/test/SemaCXX/anonymous-struct.cpp @@ -49,7 +49,7 @@ : B { // expected-note {{type is not C-compatible due to this base class}} } C; // expected-note {{type is given name 'C' for linkage purposes by this typedef declaration}} -#if __cplusplus > 201703L +#if __cplusplus > 201703L && __cplusplus < 202002L typedef struct { // expected-warning {{anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here}} static_assert([]{ return true; }()); // expected-note {{type is not C-compatible due to this lambda expression}} } Lambda1; // expected-note {{type is given name 'Lambda1' for linkage purposes by this typedef declaration}} diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -1011,7 +1011,7 @@ Lambdas in unevaluated contexts P0315R4 - No + Clang 13