diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -692,10 +692,6 @@ assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() && "Not an identifier!"); - // The substatement is always a 'statement', not a 'declaration', but is - // otherwise in the same context as the labeled-statement. - StmtCtx &= ~ParsedStmtContext::AllowDeclarationsInC; - Token IdentTok = Tok; // Save the whole token. ConsumeToken(); // eat the identifier. diff --git a/clang/test/OpenMP/allocate_messages.cpp b/clang/test/OpenMP/allocate_messages.cpp --- a/clang/test/OpenMP/allocate_messages.cpp +++ b/clang/test/OpenMP/allocate_messages.cpp @@ -141,7 +141,7 @@ } #pragma omp allocate(d3) label: -#pragma omp allocate(d4) // expected-error {{'#pragma omp allocate' cannot be an immediate substatement}} +#pragma omp allocate(d4) #pragma omp allocate(a) // expected-error {{'#pragma omp allocate' must appear in the scope of the 'a' variable declaration}} return (y); diff --git a/clang/test/OpenMP/threadprivate_messages.cpp b/clang/test/OpenMP/threadprivate_messages.cpp --- a/clang/test/OpenMP/threadprivate_messages.cpp +++ b/clang/test/OpenMP/threadprivate_messages.cpp @@ -138,7 +138,7 @@ } #pragma omp threadprivate(d3) label: -#pragma omp threadprivate(d4) // expected-error {{'#pragma omp threadprivate' cannot be an immediate substatement}} +#pragma omp threadprivate(d4) #pragma omp threadprivate(a) // expected-error {{'#pragma omp threadprivate' must appear in the scope of the 'a' variable declaration}} return (y); diff --git a/clang/test/Parser/c2x-label.c b/clang/test/Parser/c2x-label.c --- a/clang/test/Parser/c2x-label.c +++ b/clang/test/Parser/c2x-label.c @@ -2,10 +2,11 @@ // RUN: %clang_cc1 -fsyntax-only -std=c2x -Wpre-c2x-compat -verify=c2x %s void test_label_in_func() { - int x; label1: + int x; +label2: x = 1; -label2: label3: label4: +label3: label4: label5: } // c17-warning {{label at end of compound statement is a C2x extension}} \ c2x-warning {{label at end of compound statement is incompatible with C standards before C2x}}