2019-03-08 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89585
+ * parser.c (cp_parser_asm_definition): Just warn instead of error
+ on volatile qualifier outside of function body.
+
PR c++/89599
* constexpr.c (potential_constant_expression_1): Reject
REINTERPRET_CAST_P NOP_EXPRs.
inform (volatile_loc, "first seen here");
}
else
- volatile_loc = loc;
- if (!first_loc)
- first_loc = loc;
+ {
+ if (!parser->in_function_body)
+ warning_at (loc, 0, "asm qualifier %qT ignored outside of "
+ "function body", token->u.value);
+ volatile_loc = loc;
+ }
cp_lexer_consume_token (parser->lexer);
continue;
bool inline_p = (inline_loc != UNKNOWN_LOCATION);
bool goto_p = (goto_loc != UNKNOWN_LOCATION);
- if (!parser->in_function_body && (volatile_p || inline_p || goto_p))
+ if (!parser->in_function_body && (inline_p || goto_p))
{
error_at (first_loc, "asm qualifier outside of function body");
- volatile_p = inline_p = goto_p = false;
+ inline_p = goto_p = false;
}
/* Look for the opening `('. */
2019-03-08 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89585
+ * g++.dg/asm-qual-3.C: Adjust expected diagnostics for toplevel
+ asm volatile.
+
PR c++/89599
* g++.dg/ubsan/vptr-4.C: Adjust expected diagnostics.
* g++.dg/parse/array-size2.C: Likewise.
// { dg-options "-std=gnu++98" }
asm const (""); // { dg-error {'const' is not an asm qualifier} }
-asm volatile (""); // { dg-error {asm qualifier outside of function body} }
+asm volatile (""); // { dg-warning {asm qualifier 'volatile' ignored outside of function body} }
asm restrict (""); // { dg-error {expected '\(' before 'restrict'} }
asm inline (""); // { dg-error {asm qualifier outside of function body} }
asm goto (""); // { dg-error {asm qualifier outside of function body} }