[Bug c++/53205] New: Compound literals don't allow empty initializer lists
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 2 22:48:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53205
Bug #: 53205
Summary: Compound literals don't allow empty initializer lists
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
I don't care about this extension myself, but we should probably make it work
properly in C++ (see PR 40076 for another bug) or deprecate it (C++ offers
several alternative forms of initialization)
http://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html
struct foo { int i; };
int main()
{
struct foo f = ((struct foo) { });
}
cl.cc: In function ‘int main()’:
cl.cc:5:22: error: expected primary-expression before ‘struct’
struct foo f = ((struct foo) { });
^
cl.cc:5:22: error: expected ‘)’ before ‘struct’
struct foo f = ((struct foo) { });
^
An empty initializer list is allowed in C++, and as an extension in GNU C, so
it should probably work here.
More information about the Gcc-bugs
mailing list