public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59682] New: Invalid syntax accepted: new-placement without expression-list
@ 2014-01-05 8:50 frankhb1989 at gmail dot com
2015-06-16 15:55 ` [Bug c++/59682] " paolo.carlini at oracle dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: frankhb1989 at gmail dot com @ 2014-01-05 8:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59682
Bug ID: 59682
Summary: Invalid syntax accepted: new-placement without
expression-list
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: frankhb1989 at gmail dot com
Minimal case:
int main()
{
int* p = new() int;
}
This should be invalid because as per the standard(ISO C++98/03/11) or the
current working draft of the standard(WG21/N3797), a new-placement should not
be '()':
[expr.new]/1
...
new-placement:
( expression-list )
...
There is no "opt" like "postfix-expression ( expression-list opt)", etc. And
the expression-list itself should be also a non-empty sequence of tokens.
G++ silently accepts the invalid code with or without
-pedantic-errors/-std=c++98/-std=c++03/-std=++11/-std=c++1y.
However, Clang++(trunk) rejects it correctly:
a.cc:4:14: error: expected expression
int* p = new() int;
^
1 error generated.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/59682] Invalid syntax accepted: new-placement without expression-list
2014-01-05 8:50 [Bug c++/59682] New: Invalid syntax accepted: new-placement without expression-list frankhb1989 at gmail dot com
@ 2015-06-16 15:55 ` paolo.carlini at oracle dot com
2015-06-16 20:08 ` paolo at gcc dot gnu.org
2015-06-16 20:09 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-06-16 15:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59682
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2015-06-16
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
Target Milestone|--- |6.0
Ever confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/59682] Invalid syntax accepted: new-placement without expression-list
2014-01-05 8:50 [Bug c++/59682] New: Invalid syntax accepted: new-placement without expression-list frankhb1989 at gmail dot com
2015-06-16 15:55 ` [Bug c++/59682] " paolo.carlini at oracle dot com
@ 2015-06-16 20:08 ` paolo at gcc dot gnu.org
2015-06-16 20:09 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-06-16 20:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59682
--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue Jun 16 20:07:57 2015
New Revision: 224537
URL: https://gcc.gnu.org/viewcvs?rev=224537&root=gcc&view=rev
Log:
/cp
2015-06-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59682
* parser.c (cp_parser_new_placement): Reject an empty expression-list.
/testsuite
2015-06-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59682
* g++.dg/parse/new-placement1.C: New.
Added:
trunk/gcc/testsuite/g++.dg/parse/new-placement1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/59682] Invalid syntax accepted: new-placement without expression-list
2014-01-05 8:50 [Bug c++/59682] New: Invalid syntax accepted: new-placement without expression-list frankhb1989 at gmail dot com
2015-06-16 15:55 ` [Bug c++/59682] " paolo.carlini at oracle dot com
2015-06-16 20:08 ` paolo at gcc dot gnu.org
@ 2015-06-16 20:09 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-06-16 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59682
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Assignee|paolo.carlini at oracle dot com |unassigned at gcc dot gnu.org
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-16 20:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-05 8:50 [Bug c++/59682] New: Invalid syntax accepted: new-placement without expression-list frankhb1989 at gmail dot com
2015-06-16 15:55 ` [Bug c++/59682] " paolo.carlini at oracle dot com
2015-06-16 20:08 ` paolo at gcc dot gnu.org
2015-06-16 20:09 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).