This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28438] New: Anon namespace pointers in exported classes
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jul 2006 15:39:37 -0000
- Subject: [Bug c++/28438] New: Anon namespace pointers in exported classes
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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