This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15938] New: ICE with anonymous unions


The following code is accepted by the C frontend, but the C++ frontend
segfaults (since gcc 2.95.x).

===================================
typedef union
{
    struct { int i; };
    struct { char c; };
} A;

A a = { 0 };
===================================

bug.cc:7: error: union `A' with no named members cannot be initialized
bug.cc:7: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]

Apart from the segfault, should the code be accepted by the C++ frontend
as well or should it be rejected as it is now?

BTW, the PR was inspired by a question on the gcc mailing list:
http://gcc.gnu.org/ml/gcc/2004-06/msg00158.html

-- 
           Summary: ICE with anonymous unions
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]