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

             Bug #: 54162
           Summary: Does not accept static global anonymous unions or
                    structs
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: j...@joshtriplett.org


C1X, and numerous other compilers, support static anonymous unions or structs
at file scope.  For example, the following code should work with a C1X
compiler:

static union {
    unsigned x;
    unsigned y;
};

int main(void)
{
    x = 5;
    return y;
}

However, GCC says:

test.c:4:1: warning: unnamed struct/union that defines no instances [enabled by
default]
test.c: In function ‘main’:
test.c:8:5: error: ‘x’ undeclared (first use in this function)
test.c:8:5: note: each undeclared identifier is reported only once for each
function it appears in
test.c:9:12: error: ‘y’ undeclared (first use in this function)

Reply via email to