This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31903] New: unwanted anonymous namespacing linkage
- From: "mrs at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 May 2007 21:15:03 -0000
- Subject: [Bug c++/31903] New: unwanted anonymous namespacing linkage
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
It appears that 4.2 isn't making anonymous namespace variables unique (it's
also making them global). This is preventing LLVM from compiling with the 4.2
compiler.
$ cat foo.cpp
#include <typeinfo>
namespace {
class foo {
virtual void bar();
};
}
void foo::bar() {}
#ifdef FOO
const std::type_info &X = typeid(foo);
#else
const std::type_info &Y = typeid(foo);
#endif
extern const std::type_info &X;
#ifndef FOO
int main() {}
#endif
$ g++-4.2 foo.cpp -c -o a.o
$ g++-4.2 foo.cpp -c -o b.o -DFOO
$ g++-4.2 a.o b.o
ld64-73.6 failed: duplicate symbol typeinfo for (anonymous namespace)::fooin
b.o and a.o
--
Summary: unwanted anonymous namespacing linkage
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mrs at apple dot com
GCC target triplet: i686-apple-darwin9
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31903