diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -21402,7 +21402,8 @@ // OpenMP [2.13.2, critical construct, Description] // ... where hint-expression is an integer constant expression that evaluates // to a valid lock hint. - ExprResult HintExpr = VerifyPositiveIntegerConstantInClause(Hint, OMPC_hint); + ExprResult HintExpr = + VerifyPositiveIntegerConstantInClause(Hint, OMPC_hint, false); if (HintExpr.isInvalid()) return nullptr; return new (Context) diff --git a/clang/test/OpenMP/critical_messages.cpp b/clang/test/OpenMP/critical_messages.cpp --- a/clang/test/OpenMP/critical_messages.cpp +++ b/clang/test/OpenMP/critical_messages.cpp @@ -67,10 +67,14 @@ foo(); #pragma omp critical (name2) hint(argc) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}} foo(); - #pragma omp critical (name) hint(N) // expected-error {{argument to 'hint' clause must be a strictly positive integer value}} expected-error {{constructs with the same name must have a 'hint' clause with the same value}} expected-note {{'hint' clause with value '4'}} + #pragma omp critical (name) hint(N) // expected-error {{argument to 'hint' clause must be a non-negative integer value}} expected-error {{constructs with the same name must have a 'hint' clause with the same value}} expected-note {{'hint' clause with value '4'}} foo(); #pragma omp critical hint(N) // expected-error {{the name of the construct must be specified in presence of 'hint' clause}} foo(); + + const int omp_lock_hint_none = 0; + #pragma omp critical (name3) hint(omp_lock_hint_none) + foo(); return 0; } @@ -132,7 +136,7 @@ foo(); #pragma omp critical (name) hint(23) // expected-note {{previous 'hint' clause with value '23'}} foo(); - #pragma omp critical hint(-5) // expected-error {{argument to 'hint' clause must be a strictly positive integer value}} + #pragma omp critical hint(-5) // expected-error {{argument to 'hint' clause must be a non-negative integer value}} foo(); #pragma omp critical hint(1) // expected-error {{the name of the construct must be specified in presence of 'hint' clause}} foo();