[Bug c/53548] New: allow flexible array members in unions like zero-length arrays

vapier at gentoo dot org gcc-bugzilla@gcc.gnu.org
Fri Jun 1 02:13:00 GMT 2012


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

             Bug #: 53548
           Summary: allow flexible array members in unions like
                    zero-length arrays
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vapier@gentoo.org


gcc will accept this code:
struct {
    short op;
    union {
        int i;
        char foo[0];
    };
};

but rejects this:
struct {
    short op;
    union {
        int i;
        char foo[];
    };
};

with the error:
error: flexible array member in otherwise empty struct



More information about the Gcc-bugs mailing list