From: Paolo Carlini Date: Tue, 16 Jun 2015 20:07:57 +0000 (+0000) Subject: re PR c++/59682 (Invalid syntax accepted: new-placement without expression-list) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba394ca69b1444dd743bcea7c5c0825837cc108e;p=gcc.git re PR c++/59682 (Invalid syntax accepted: new-placement without expression-list) /cp 2015-06-16 Paolo Carlini PR c++/59682 * parser.c (cp_parser_new_placement): Reject an empty expression-list. /testsuite 2015-06-16 Paolo Carlini PR c++/59682 * g++.dg/parse/new-placement1.C: New. From-SVN: r224537 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d2908c20a66..88f33d7b84c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-06-16 Paolo Carlini + + PR c++/59682 + * parser.c (cp_parser_new_placement): Reject an empty expression-list. + 2015-06-16 Jason Merrill PR c++/66536 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 15b920a1fe9..b8218714f6d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -7560,6 +7560,9 @@ cp_parser_new_placement (cp_parser* parser) /*allow_expansion_p=*/true, /*non_constant_p=*/NULL)); + if (expression_list && expression_list->is_empty ()) + error ("expected expression-list or type-id"); + return expression_list; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 918cf5283c8..76870d374f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-16 Paolo Carlini + + PR c++/59682 + * g++.dg/parse/new-placement1.C: New. + 2015-06-16 David Malcolm * jit.dg/all-non-failing-tests.h: Add test-compound-assignment.c. diff --git a/gcc/testsuite/g++.dg/parse/new-placement1.C b/gcc/testsuite/g++.dg/parse/new-placement1.C new file mode 100644 index 00000000000..713690d897b --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/new-placement1.C @@ -0,0 +1,3 @@ +// PR c++/59682 + +int* p = new() int; // { dg-error "expected expression-list or type-id" }