The source-range handling for the array form of operator
new/delete erroneously assumed that the "]" was present,
leading to a dereference of NULL when it's absent.
Fix it thusly.
gcc/cp/ChangeLog:
PR c++/71184
* parser.c (cp_parser_operator): For array new/delete, check that
cp_parser_require returned a non-NULL token before dereferencing
it.
gcc/testsuite/ChangeLog:
PR c++/71184
* g++.dg/pr71184.C: New test case.
From-SVN: r236483
+2016-05-19 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/71184
+ * parser.c (cp_parser_operator): For array new/delete, check that
+ cp_parser_require returned a non-NULL token before dereferencing
+ it.
+
2016-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
* decl.c (finish_enum_value_list): Use the specified mode.
/* Consume the `[' token. */
cp_lexer_consume_token (parser->lexer);
/* Look for the `]' token. */
- end_loc = cp_parser_require (parser, CPP_CLOSE_SQUARE,
- RT_CLOSE_SQUARE)->location;
+ if (cp_token *close_token
+ = cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE))
+ end_loc = close_token->location;
id = ansi_opname (op == NEW_EXPR
? VEC_NEW_EXPR : VEC_DELETE_EXPR);
}
+2016-05-19 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/71184
+ * g++.dg/pr71184.C: New test case.
+
2016-05-19 Kelvin Nilsen <kelvin@gcc.gnu.org>
* gcc.target/powerpc/darn-0.c: New test.
--- /dev/null
+operator new[ // { dg-error "expected type-specifier before 'new'" }