aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index b633653..0691c96 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4537,9 +4537,9 @@ cp_parser_new_expression (cp_parser* parser)
but GCC used to allowed this, so we check and emit a sensible error
message for this case. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
- {
- error ("array bound forbidden after parenthesized type-id");
- inform ("try removing the parentheses around the type-id");
+ {
+ error ("array bound forbidden after parenthesized type-id");
+ inform ("try removing the parentheses around the type-id");
cp_parser_direct_new_declarator (parser);
}
}
@@ -11528,10 +11528,14 @@ cp_parser_initializer_clause (cp_parser* parser, bool* non_constant_p)
/* If it is not a `{', then we are looking at an
assignment-expression. */
if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
- initializer
- = cp_parser_constant_expression (parser,
- /*allow_non_constant_p=*/true,
- non_constant_p);
+ {
+ initializer
+ = cp_parser_constant_expression (parser,
+ /*allow_non_constant_p=*/true,
+ non_constant_p);
+ if (!*non_constant_p)
+ initializer = fold_non_dependent_expr (initializer);
+ }
else
{
/* Consume the `{' token. */