For the following invalid code snippet

==================
struct A
{
    union B b;
};

struct B;
==================

the C++ frontend generates the following error message:

bug.cc:3: error: field 'b' has incomplete type
bug.cc:6: error: 'struct' tag used in naming 'union B'

While the first line is OK, the second one is not.
Apparently, union B is added to the global namespace.
IMHO it should be placed into A.


-- 
           Summary: Incomplete type in struct added to global namespace
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: diagnostic, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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

Reply via email to