diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -806,10 +806,10 @@ 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 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -3602,7 +3602,7 @@ 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 --- a/clang/test/Parser/cxx2a-concepts-requires-expr.cpp +++ b/clang/test/Parser/cxx2a-concepts-requires-expr.cpp @@ -134,13 +134,13 @@ // 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 --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -934,7 +934,7 @@ P1972R0 - No + No P1980R0 @@ -944,9 +944,11 @@ P2092R0 + Clang 13 P2113R0 + No