public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54162] New: Does not accept static global anonymous unions or structs
@ 2012-08-02 23:04 josh at joshtriplett dot org
  2012-08-02 23:23 ` [Bug c/54162] " joseph at codesourcery dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: josh at joshtriplett dot org @ 2012-08-02 23:04 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: josh@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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-20 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-02 23:04 [Bug c/54162] New: Does not accept static global anonymous unions or structs josh at joshtriplett dot org
2012-08-02 23:23 ` [Bug c/54162] " joseph at codesourcery dot com
2012-08-03  8:07 ` rguenth at gcc dot gnu.org
2012-08-20 14:50 ` [Bug c/54162] Please accept static global anonymous unions or structs as an extension josh at joshtriplett dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).