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: unassig...@gcc.gnu.org
        ReportedBy: r...@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.

Reply via email to