g++/trunk/x86/rev.160690 -O0 compile test w/o errors, but with -O[ 123] generates undefined symbol
# g++ -O0 -c 2010_06_13.cpp && nm -uAC 2010_06_13.o | grep OnProv # g++ -O -c 2010_06_13.cpp && nm -uAC 2010_06_13.o | grep OnProv 2010_06_13.o: U FOO::A<char>::OnProv() # cat 2010_06_13.cpp namespace FOO { template <typename T> class A { public: A(); void Enum(); virtual void OnProv() = 0; virtual ~A() { } }; typedef A<char> B; template<typename T> inline A<T>::A() { } template<typename T> inline void A<T>::Enum () { OnProv (); } } // namespace FOO class C {}; class D: public C, public FOO::B { public: void OnProv() {} }; void aaa() { D x; x.Enum(); } # g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/i686-redhat-linux/4.6.0/lto-wrapper Target: i686-redhat-linux Configured with: ../gcc-current/configure --prefix=/usr/local/gcc_current --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=yes --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++ --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux --enable-lto --enable-version-specific-runtime-libs : (reconfigured) ../gcc-current/configure --prefix=/usr/local/gcc_current --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=yes --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++ --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux --enable-lto --enable-version-specific-runtime-libs : (reconfigured) ../gcc-current/configure --prefix=/usr/local/gcc_current --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=yes --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++ --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux --enable-lto --enable-version-specific-runtime-libs : (reconfigured) ../gcc-current/configure --prefix=/usr/local/gcc_current --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=yes --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++ --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux --enable-lto --enable-version-specific-runtime-libs : (reconfigured) ../gcc-current/configure --prefix=/usr/local/gcc_current --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=yes --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++ --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux --enable-lto --enable-version-specific-runtime-libs : (reconfigured) ../gcc-current/configure --prefix=/usr/local/gcc_current --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=yes --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++ --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux --enable-lto --enable-version-specific-runtime-libs : (reconfigured) ../gcc-current/configure --prefix=/usr/local/gcc_current --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=yes --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++ --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux --enable-lto --enable-version-specific-runtime-libs Thread model: posix gcc version 4.6.0 20100613 (experimental) [trunk revision 160690] (GCC) -- Summary: g++ -O[ 123] generates undefined symbol Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dimhen at gmail dot com GCC build triplet: i686-redhat-linux GCC host triplet: i686-redhat-linux GCC target triplet: i686-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44535