http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50169

             Bug #: 50169
           Summary: "new struct X {{}};" incorrectly treated as an invalid
                    struct-definition
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: schaub.johan...@googlemail.com


The following looks like valid code:

 struct A { int a; }; 
 int main() { 
   new struct A {{ }}; 
 }

The type-specifier-seq "struct A" is followed by a braced-init-list "{{}}". But
GCC says:

main1.cpp: In function 'int main()':
main1.cpp:3:16: error: types may not be defined in a new-type-id
main1.cpp:3:17: error: expected unqualified-id before '{' token

As far as I can see, I would only define a new type if I would say:

    new struct A { };

But the two-braces disambiguates it.

Reply via email to