From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30412 invoked by alias); 10 Oct 2006 16:16:19 -0000 Received: (qmail 30385 invoked by uid 48); 10 Oct 2006 16:16:11 -0000 Date: Tue, 10 Oct 2006 16:16:00 -0000 Subject: [Bug c++/29417] New: link fails with debug and anonymous namespace X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "peter at chocky dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-10/txt/msg00807.txt.bz2 List-Id: This is with: gcc (GCC) 4.2.0 20061007 (experimental) On x86 Debian and under Fedora Core 3. Using the lamba part of the boost library, the following is seen: /tmp/ccNdhcXx.o:(.debug_info+0xec9): undefined reference to `boost::lambda::(anonymous namespace)::free2' /tmp/ccNdhcXx.o:(.debug_info+0xed8): undefined reference to `boost::lambda::(anonymous namespace)::free3' /tmp/ccNdhcXx.o:(.debug_info+0x47f2): undefined reference to `boost::lambda::(anonymous namespace)::free2' /tmp/ccNdhcXx.o:(.debug_info+0x4806): undefined reference to `boost::lambda::(anonymous namespace)::free3' I don't think the fault is in the boost library. Here is the code in question: namespace { // These are constants types and need to be initialised boost::lambda::placeholder1_type free1 = boost::lambda::placeholder1_type(); boost::lambda::placeholder2_type free2 = boost::lambda::placeholder2_type(); boost::lambda::placeholder3_type free3 = boost::lambda::placeholder3_type(); boost::lambda::placeholder1_type& _1 = free1; boost::lambda::placeholder2_type& _2 = free2; boost::lambda::placeholder3_type& _3 = free3; // _1, _2, ... naming scheme by Peter Dimov } // unnamed To trigger the problem requires at least -O and -g2. My C++ isn't good enough to comment further. I attach a minimal preprocessed case. compile with: g++-4.2 test.ii -O -g2 This works correctly on previous GCC versions, and with -g1. -- Summary: link fails with debug and anonymous namespace Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peter at chocky dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29417