[Bug c++/51832] [4.7 regression] Rev.182970 causes LTO link errors (multiple definitions of allocator_traits)

markus at trippelsdorf dot de gcc-bugzilla@gcc.gnu.org
Thu Jan 12 09:07:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51832

--- Comment #2 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-01-12 09:06:57 UTC ---
(In reply to comment #1)
> Can you attach preprocessed sources to reproduce this?

I've reduced it to this snipped:

 % cat foo.cpp
#include <vector>

struct foo
{
  void bar ()
  {
    s.push_back (0);
  }
  std::vector <int> s;
};

 % g++ foo.cpp foo.cpp -flto -std=gnu++0x
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../x86_64-pc-linux-gnu/bin/ld:
error: /tmp/ccZEKdVj.o: multiple definition of
'_ZNSt16allocator_traitsISaIiEE18__construct_helperIiJiEE5valueE'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../x86_64-pc-linux-gnu/bin/ld:
/tmp/cc1lLTi3.o: previous definition here
../sysdeps/x86_64/elf/start.S:109: error: undefined reference to 'main'
collect2: error: ld returned 1 exit statu



More information about the Gcc-bugs mailing list