PR c++/71184: Fix NULL dereference in cp_parser_operator
commit08025288b91765417449779b85732fb1faa37410
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 May 2016 18:10:30 +0000 (19 18:10 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 May 2016 18:10:30 +0000 (19 18:10 +0000)
tree400ffed166e4c228ca8195177c6d22df759aff75
parent217f00a7946150978e709981b7db64be1fed6c63
PR c++/71184: Fix NULL dereference in cp_parser_operator

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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236483 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr71184.C [new file with mode: 0644]