From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15324 invoked by alias); 11 May 2007 21:15:16 -0000 Received: (qmail 15034 invoked by uid 48); 11 May 2007 21:15:03 -0000 Date: Fri, 11 May 2007 21:15:00 -0000 Subject: [Bug c++/31903] New: unwanted anonymous namespacing linkage X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mrs at apple dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-05/txt/msg00853.txt.bz2 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 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