This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/28438] New: Anon namespace pointers in exported classes


Both KDE and OOo fail to build with the anon namespace not exported changes.
A short testcase of what they are doing:
cat > test.h <<EOF
namespace { struct A {}; }
struct B
{
  A *a;
  B ();
};
EOF
cat > test1.C <<EOF
#include "test.h"

B::B () : a(0)
{
}

B b;

int
main (void)
{
}
EOF
cat > test2.C <<EOF
#include "test.h"

B c;
EOF
g++ -c test1.C
g++ -c test2.C
g++ -o test test1.o test2.o
This doesn't link with GCC head, because B::B() constructor is a local symbol
in test1.s.

My understanding is that this is a [basic.def.odr]/5 violation, as
lthough each definition consists of the same sequence of tokens,
corresponding names (in this case A) don't refer to the same entity
(as A's definition in anonymous namespace means it is a different thing
in each translation unit), but I'd like some confirmation about this.


-- 
           Summary: Anon namespace pointers in exported classes
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]