Bug 32053 - Anonymous union members' names should be distinct within enclosing scope
Summary: Anonymous union members' names should be distinct within enclosing scope
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-23 10:05 UTC by Andrew Stubbs
Modified: 2009-12-26 14:32 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.4.3 4.2.1 4.4.0
Known to fail: 4.1.1
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Stubbs 2007-05-23 10:05:07 UTC
The following program should not compile:

extern int foo;
static union
{
 int foo; // clash
};

C++ standard clause 9.5/2 states that members of anonymous unions must have names distinct from other names in the same scope.

If the `extern' keyword is removed from the example above, the error is diagnosed correctly (followed by an ICE).
Comment 1 Andrew Stubbs 2007-10-31 16:15:14 UTC
This bug appears to be no longer present in GCC 4.2.1.
Comment 2 Paolo Carlini 2009-12-26 14:32:12 UTC
Yes, fixed long time ago.