[Bug c++/84027] New: new-expression does not accept an attribute-specifier-seq
smw at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 24 16:48:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84027
Bug ID: 84027
Summary: new-expression does not accept an
attribute-specifier-seq
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: smw at gcc dot gnu.org
Target Milestone: ---
The standard [expr.new]/1 defines the new-type-id part of a new expression as
having (one or more) attribute-specifier-seq but GCC does not accept that
construct. Example code:
void f() { char* p = new char[sizeof(int)] alignas(int); }
GCC 8.0.1 20180117 (exprimental) with -std=c++14 -pedantic gives the following
diagnostic.
<source>: In function 'void f()':
1 : <source>:1:44: error: expected ',' or ';' before 'alignas'
void f() { char* p = new char[sizeof(int)] alignas(int); }
^~~~~~~
1 : <source>:1:18: warning: unused variable 'p' [-Wunused-variable]
void f() { char* p = new char[sizeof(int)] alignas(int); }
^
Note that the example code is accepted without error by clang and ICC.
More information about the Gcc-bugs
mailing list