Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -14577,18 +14577,7 @@ if (Rec.ExprContext == ExpressionKind::EK_TemplateArgument || Rec.isUnevaluated() || (Rec.isConstantEvaluated() && !getLangOpts().CPlusPlus17)) { unsigned D; - if (Rec.isUnevaluated()) { - // C++11 [expr.prim.lambda]p2: - // A lambda-expression shall not appear in an unevaluated operand - // (Clause 5). - D = diag::err_lambda_unevaluated_operand; - } else if (Rec.isConstantEvaluated() && !getLangOpts().CPlusPlus17) { - // C++1y [expr.const]p2: - // A conditional-expression e is a core constant expression unless the - // evaluation of e, following the rules of the abstract machine, would - // evaluate [...] a lambda-expression. - D = diag::err_lambda_in_constant_expression; - } else if (Rec.ExprContext == ExpressionKind::EK_TemplateArgument) { + if (Rec.ExprContext == ExpressionKind::EK_TemplateArgument) { // C++17 [expr.prim.lamda]p2: // A lambda-expression shall not appear [...] in a template-argument. D = diag::err_lambda_in_invalid_context; Index: clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp =================================================================== --- clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp +++ clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp @@ -15,9 +15,9 @@ }; void unevaluated_operand(P &p, int i) { - int i2 = sizeof([] ()->int { return 0; }()); // expected-error{{lambda expression in an unevaluated operand}} + int i2 = sizeof([] ()->int { return 0; }()); const std::type_info &ti1 = typeid([&]() -> P& { return p; }()); - const std::type_info &ti2 = typeid([&]() -> int { return i; }()); // expected-error{{lambda expression in an unevaluated operand}} + const std::type_info &ti2 = typeid([&]() -> int { return i; }()); } template @@ -37,7 +37,7 @@ // because the copy-initialization of the capture of boom_float occurs in an // unevaluated operand. const std::type_info &ti2 - = typeid([=]() -> int { boom_float.tickle(); return 0; }()); // expected-error{{lambda expression in an unevaluated operand}} + = typeid([=]() -> int { boom_float.tickle(); return 0; }()); auto foo = [=]() -> int { boom_double.tickle(); return 0; }; // expected-note{{in instantiation of member function 'Boom::Boom' requested here}} }