(This is not the same issue as 37352.)

> cat Base.hh
struct Base1 {
        virtual ~Base1() {}
};
struct Base2 {
        virtual void f() = 0;
};
struct Base : Base1, Base2 {
        virtual void f();
};


> cat Base.cc
#include "Base.hh"
void Base::f() {}


> cat Foo.cc
#include "Base.hh"

struct Foo : Base {
        virtual void g();
};

void Foo::g() {}

int main() {}


> g++ -flto -c Base.cc
> g++ -flto -c Foo.cc
> g++ -flto Base.o Foo.o 2>&1 | c++filt
/usr/bin/ld: /tmp/ccqIEJHE.lto.o: in function vtable for
Base:Base.o(.gnu.linkonce.r._ZTV4Base+0x38): error: undefined reference to
'non-virtual thunk to Base::f()'
/usr/bin/ld: /tmp/ccqIEJHE.lto.o: in function vtable for
Foo:Base.o(.gnu.linkonce.r._ZTV3Foo+0x40): error: undefined reference to
'non-virtual thunk to Base::f()'

Without using -flto this links just fine.

I'm using SVN revision tr...@155034 on linux x86_64.


-- 
           Summary: link error with -flto  (undefined reference to 'non-
                    virtual thunk ...)
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wouter dot vermaelen at scarlet dot be


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

Reply via email to