diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 7e4b0841e06b1..a4aa7fec4d557 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -806,10 +806,10 @@ def err_requires_expr_expected_type_constraint : Error< def err_requires_expr_simple_requirement_noexcept : Error< "'noexcept' can only be used in a compound requirement (with '{' '}' around " "the expression)">; -def warn_requires_expr_in_simple_requirement : Warning< - "this requires expression will only be checked for syntactic validity; did " +def err_requires_expr_in_simple_requirement : Error< + "requires expression in requirement body; did " "you intend to place it in a nested requirement? (add another 'requires' " - "before the expression)">, InGroup>; + "before the expression)">; def err_missing_dependent_template_keyword : Error< "use 'template' keyword to treat '%0' as a dependent template name">; diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index f3d10b4a08895..3f357233f9bb4 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -3602,7 +3602,7 @@ ExprResult Parser::ParseRequiresExpression() { break; } if (!Expression.isInvalid() && PossibleRequiresExprInSimpleRequirement) - Diag(StartLoc, diag::warn_requires_expr_in_simple_requirement) + Diag(StartLoc, diag::err_requires_expr_in_simple_requirement) << FixItHint::CreateInsertion(StartLoc, "requires"); if (auto *Req = Actions.ActOnSimpleRequirement(Expression.get())) Requirements.push_back(Req); diff --git a/clang/test/Parser/cxx2a-concepts-requires-expr.cpp b/clang/test/Parser/cxx2a-concepts-requires-expr.cpp index d1a31b4f93ef1..d22f21b786f44 100644 --- a/clang/test/Parser/cxx2a-concepts-requires-expr.cpp +++ b/clang/test/Parser/cxx2a-concepts-requires-expr.cpp @@ -134,13 +134,13 @@ void r37(bool b) requires requires { 1 } {} // expected-error@-1 {{expected ';' at end of requirement}} bool r38 = requires { requires { 1; }; }; -// expected-warning@-1 {{this requires expression will only be checked for syntactic validity; did you intend to place it in a nested requirement? (add another 'requires' before the expression)}} +// expected-error@-1 {{requires expression in requirement body; did you intend to place it in a nested requirement? (add another 'requires' before the expression)}} bool r39 = requires { requires () { 1; }; }; -// expected-warning@-1 {{this requires expression will only be checked for syntactic validity; did you intend to place it in a nested requirement? (add another 'requires' before the expression)}} +// expected-error@-1 {{requires expression in requirement body; did you intend to place it in a nested requirement? (add another 'requires' before the expression)}} bool r40 = requires { requires (int i) { i; }; }; -// expected-warning@-1 {{this requires expression will only be checked for syntactic validity; did you intend to place it in a nested requirement? (add another 'requires' before the expression)}} +// expected-error@-1 {{requires expression in requirement body; did you intend to place it in a nested requirement? (add another 'requires' before the expression)}} bool r41 = requires { requires (); }; // expected-error@-1 {{expected expression}} diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html index 2ad2047f68d00..0e78d63220e49 100755 --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -934,7 +934,7 @@

C++20 implementation status

P1972R0 - No + No P1980R0 @@ -944,9 +944,11 @@

C++20 implementation status

P2092R0 + Clang 13 P2113R0 + No