@@ -3556,8 +3556,11 @@ cp_parser_skip_to_closing_parenthesis_1
switch (token->type)
{
- case CPP_EOF:
case CPP_PRAGMA_EOL:
+ if (!parser->lexer->in_pragma)
+ break;
+ /* FALLTHRU */
+ case CPP_EOF:
/* If we've run out of tokens, then there is no closing `)'. */
return 0;
@@ -3652,8 +3655,11 @@ cp_parser_skip_to_end_of_statement (cp_p
switch (token->type)
{
- case CPP_EOF:
case CPP_PRAGMA_EOL:
+ if (!parser->lexer->in_pragma)
+ break;
+ /* FALLTHRU */
+ case CPP_EOF:
/* If we've run out of tokens, stop. */
return;
@@ -3742,8 +3748,11 @@ cp_parser_skip_to_end_of_block_or_statem
switch (token->type)
{
- case CPP_EOF:
case CPP_PRAGMA_EOL:
+ if (!parser->lexer->in_pragma)
+ break;
+ /* FALLTHRU */
+ case CPP_EOF:
/* If we've run out of tokens, stop. */
return;
@@ -3792,8 +3801,11 @@ cp_parser_skip_to_closing_brace (cp_pars
switch (token->type)
{
- case CPP_EOF:
case CPP_PRAGMA_EOL:
+ if (!parser->lexer->in_pragma)
+ break;
+ /* FALLTHRU */
+ case CPP_EOF:
/* If we've run out of tokens, stop. */
return false;
@@ -22498,8 +22510,11 @@ cp_parser_skip_to_closing_square_bracket
switch (token->type)
{
- case CPP_EOF:
case CPP_PRAGMA_EOL:
+ if (!parser->lexer->in_pragma)
+ break;
+ /* FALLTHRU */
+ case CPP_EOF:
/* If we've run out of tokens, then there is no closing `]'. */
return false;
@@ -26008,8 +26023,11 @@ cp_parser_skip_balanced_tokens (cp_parse
do
switch (cp_lexer_peek_nth_token (parser->lexer, n++)->type)
{
- case CPP_EOF:
case CPP_PRAGMA_EOL:
+ if (!parser->lexer->in_pragma)
+ break;
+ /* FALLTHRU */
+ case CPP_EOF:
/* Ran out of tokens. */
return orig_n;
case CPP_OPEN_PAREN:
@@ -0,0 +1,11 @@
+// PR c++/88258
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+void
+foo (bar int p) // { dg-error "variable or field|was not declared in this scope" }
+{
+ int i, x;
+ #pragma omp atomic write
+ x = 6;
+}