This is with Boost 1.44.0. C:\bug>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.5.1/lto-wrapper.exe Target: i686-pc-mingw32 Configured with: ../src/configure --prefix=/c/temp/gcc/dest --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release --enable-lto Thread model: win32 gcc version 4.5.1 (GCC)
C:\bug>type foo.cpp #include <string> #include <boost/format.hpp> using namespace std; using namespace boost; string foo(int n) { return str(format("foo(%1%)") % n); } C:\bug>type bar.cpp #include <iostream> #include <ostream> #include <string> #include <boost/format.hpp> using namespace std; using namespace boost; string foo(int n); string bar(int n) { return str(format("bar(%1%)") % n); } int main() { cout << foo(1) << endl; cout << bar(2) << endl; } C:\bug>g++ -Wall -Wextra -E foo.cpp -o foo.ii C:\bug>g++ -Wall -Wextra -E bar.cpp -o bar.ii C:\bug>g++ -Wall -Wextra foo.ii bar.ii -o baz.exe C:\bug>baz foo(1) bar(2) C:\bug>g++ -Wall -Wextra -flto foo.ii bar.ii -o baz.exe c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn32_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io13too_many_argsEEEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: error: '_ZThn12_N5boost16exception_detail19error_info_injectorINS_2io17bad_format_stringEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn12_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io12too_few_argsEEEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: error: '_ZThn12_N5boost16exception_detail19error_info_injectorINS_2io13too_many_argsEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:411:13: error: '_ZThn32_NK5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io17bad_format_stringEEEE5cloneEv' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:411:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/format/alt_sstream.hpp:123:9: error: '_ZTv0_n12_N5boost2io22basic_oaltstringstreamIcSt11char_traitsIcESaIcEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/format/alt_sstream.hpp:123:9: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn12_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io13too_many_argsEEEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:411:13: error: '_ZThn32_NK5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io12too_few_argsEEEE5cloneEv' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:411:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: error: '_ZThn12_N5boost16exception_detail19error_info_injectorINS_2io13too_many_argsEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn32_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io17bad_format_stringEEEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn12_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io17bad_format_stringEEEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:417:13: error: '_ZThn32_NK5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io13too_many_argsEEEE7rethrowEv' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:417:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: error: '_ZThn12_N5boost16exception_detail19error_info_injectorINS_2io17bad_format_stringEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn32_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io12too_few_argsEEEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn12_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io13too_many_argsEEEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:417:13: error: '_ZThn32_NK5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io17bad_format_stringEEEE7rethrowEv' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:417:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: error: '_ZThn12_N5boost16exception_detail19error_info_injectorINS_2io12too_few_argsEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn32_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io12too_few_argsEEEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn32_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io13too_many_argsEEEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn12_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io17bad_format_stringEEEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/format/alt_sstream.hpp:123:9: error: '_ZTv0_n12_N5boost2io22basic_oaltstringstreamIcSt11char_traitsIcESaIcEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/format/alt_sstream.hpp:123:9: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn12_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io12too_few_argsEEEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: error: '_ZThn12_N5boost16exception_detail19error_info_injectorINS_2io12too_few_argsEED1Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:305:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: error: '_ZThn32_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io17bad_format_stringEEEED0Ev' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:404:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:411:13: error: '_ZThn32_NK5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io13too_many_argsEEEE5cloneEv' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:411:13: note: previously defined here c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:417:13: error: '_ZThn32_NK5boost16exception_detail10clone_implINS0_19error_info_injectorINS_2io12too_few_argsEEEE7rethrowEv' has already been defined c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.5.1/../../../../include/boost/exception/exception.hpp:417:13: note: previously defined here lto-wrapper: C:\MinGW\bin/g++.exe returned 1 exit status collect2: lto-wrapper returned 1 exit status -- Summary: LTO doesn't work with Boost on MinGW Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gordon dot magnusson at gmail dot com GCC build triplet: i686-pc-mingw32 GCC host triplet: i686-pc-mingw32 GCC target triplet: i686-pc-mingw32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45343