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++/29417] New: link fails with debug and anonymous namespace


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


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