https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95901
--- Comment #2 from Thomas Schwinge <tschwinge at gcc dot gnu.org> --- For the record, the recent commit 1bf976a5de69ecd9b1e10eb7515357b98e78faf7 "openmp: Actually ignore pragma_stmt pragmas for which c_parser_pragma returns false" gets us rid of the following C vs. C++ difference: @@ -17,9 +17,15 @@ pr.c:21:9: error: ‘#pragma omp target enter data’ may only be used in compound statements 21 | #pragma omp target enter data map(to:argc) // { dg-bogus "may only be used in compound statements" } | ^~~ +pr.c:23:5: error: expected primary-expression before ‘}’ token + 23 | } + | ^ pr.c:26:9: error: ‘#pragma omp target exit data’ may only be used in compound statements 26 | #pragma omp target exit data map(from:argc) // { dg-bogus "may only be used in compound statements" } | ^~~ +pr.c:27:1: error: expected primary-expression before ‘}’ token + 27 | } + | ^ pr.c:25:2: warning: label ‘l1’ defined but not used [-Wunused-label] 25 | l1: // { dg-bogus "label at end of compound statement" } | ^~ Meaning: no more 'error: expected primary-expression before ‘}’ token' diagnostics for C++, as already the case for C. (But that commit does not otherwise address this issue.)