diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 5b0704658a25..26dc3998ad80 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -282,6 +282,7 @@ bool Parser::SkipUntil(ArrayRef Toks, SkipUntilFlags Flags) { // Ran out of tokens. return false; + case tok::annot_pragma_openmp: case tok::annot_pragma_openmp_end: // Stop before an OpenMP pragma boundary. case tok::annot_module_begin: diff --git a/clang/test/OpenMP/openmp_check.cpp b/clang/test/OpenMP/openmp_check.cpp new file mode 100644 index 000000000000..c9b5eb0b9cba --- /dev/null +++ b/clang/test/OpenMP/openmp_check.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s +int nested(int a) { +#pragma omp parallel + ++a; + + auto F = [&]() { // expected-error {{expected expression}} expected-error {{expected ';' at end of declaration}} expected-warning {{'auto' type specifier is a C++11 extension}} +#pragma omp parallel + { +#pragma omp target + ++a; + } + }; + F(); // expected-error {{C++ requires a type specifier for all declarations}} + return a; // expected-error {{expected unqualified-id}} +}// expected-error {{extraneous closing brace ('}')}}