http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46376
--- Comment #1 from Rodrigo Rivas <rodrigorivascosta at gmail dot com>
2010-11-08 17:07:11 UTC ---
Sorry for the previous empty body... my dog ate my keyboard ;-)
Anyway, the following code fails when compiled with MinGW:
$ i686-mingw32msvc-g++ -v
Using built-in specs.
COLLECT_GCC=i686-mingw32msvc-g++
COLLECT_LTO_WRAPPER=/home/rodrigo/local/mingw/libexec/gcc/i686-mingw32msvc/4.6.0/lto-wrapper
Target: i686-mingw32msvc
Configured with: ../configure --prefix=/home/rodrigo/local/mingw
--target=i686-mingw32msvc --build=i686-linux --with-sysroot=/home/rodrigo/local
--enable-lto --enable-languages=c,c++,lto --enable-multilib=no
--with-system-zlib=yes --enable-threads --disable-nls --with-arch-32=i686
--disable-sjlj-exceptions
Thread model: win32
gcc version 4.6.0 20101108 (experimental) (GCC)
*** File: test.h
#ifndef TEST_H_INCLUDED
#define TEST_H_INCLUDED
struct VBase
{
virtual ~VBase()
{
}
};
struct MyClass : virtual public VBase
{
};
#endif /* TEST_H_INCLUDED */
*** File: test.cpp
#include "test.h"
int main()
{
MyClass x;
return 0;
}
*** File: foo.cpp
#include "test.h"
int main()
{
MyClass x;
return 0;
}
*** File: bar.cpp
#include "test.h"
int bar()
{
MyClass x;
return 0;
}
$ i686-mingw32msvc-g++ -flto *.cpp
test.h:11:8: error: '_ZTv0_n12_N7MyClassD1Ev' has already been defined
test.h:11:8: note: previously defined here
test.h:11:8: error: '_ZTv0_n12_N7MyClassD0Ev' has already been defined
test.h:11:8: note: previously defined here
lto-wrapper: i686-mingw32msvc-g++ returned 1 exit status
collect2: lto-wrapper returned 1 exit status
However, with a native build of the exactly same GCC revision it compiles and
links correctly.
This *may* be a duplicate of Bug 45343.
Regards.
Rodrigo