When compiling the attached testcase, the explicitly instantiated templates do
not appear in the compiled object, nor do they appear in the intermediate
assembly output. Compiling the same source with g++ 3.4.4, 3.3.4, and 2.95.4
works as expected.
Compile line:
g++-4.0 -v -save-temps -c -o b.o b.cc
Testcase:
# 1 "b.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "b.cc"
# 1 "b.hh" 1
template <typename T>
class b {
public:
b();
~b();
};
template class b<int>;
template class b<float>;
# 2 "b.cc" 2
template <typename T>
b<T>::b()
{
}
template <typename T>
b<T>::~b()
{
}
Intermediate assembly:
.file "b.cc"
.ident "GCC: (GNU) 4.0.0 20050301 (prerelease) (Debian
4.0-0pre6ubuntu7)"
.section .note.GNU-stack,"",@progbits
GCC (g++4.0 -v) version:
Using built-in specs.
Target: i486-linux
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada
--prefix=/usr --libexecdir=/usr/lib --enable-shared --with-system-zlib
--enable-nls --enable-threads=posix --without-included-gettext
--program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --enable-gtk-cairo --enable-mpfr --enable-checking=release
i486-linux
Thread model: posix
gcc version 4.0.0 20050301 (prerelease) (Debian 4.0-0pre6ubuntu7)
Compile (g++-4.0 -v -save-temps) log:
g++-4.0 -v -save-temps -c -o b.o b.cc
Using built-in specs.
Target: i486-linux
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada
--prefix=/usr --libexecdir=/usr/lib --enable-share
d --with-system-zlib --enable-nls --enable-threads=posix
--without-included-gettext --program-suffix=-4.0 --enable-__cxa_atexit --
enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug
--enable-java-gc=boehm --enable-java-awt=gtk --enable-
gtk-cairo --enable-mpfr --enable-checking=release i486-linux
Thread model: posix
gcc version 4.0.0 20050301 (prerelease) (Debian 4.0-0pre6ubuntu7)
/usr/lib/gcc/i486-linux/4.0.0/cc1plus -E -quiet -v -D_GNU_SOURCE b.cc
-mtune=i486 -fpch-preprocess -o b.ii
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux/4.0.0/../../../../i486-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i486-linux/4.0.0/../../../../include/c++/4.0.0
/usr/lib/gcc/i486-linux/4.0.0/../../../../include/c++/4.0.0/i486-linux
/usr/lib/gcc/i486-linux/4.0.0/../../../../include/c++/4.0.0/backward
/usr/local/include
/usr/lib/gcc/i486-linux/4.0.0/include
/usr/include
End of search list.
/usr/lib/gcc/i486-linux/4.0.0/cc1plus -fpreprocessed b.ii -quiet -dumpbase b.cc
-mtune=i486 -auxbase-strip b.o -version -o b.s
GNU C++ version 4.0.0 20050301 (prerelease) (Debian 4.0-0pre6ubuntu7)
(i486-linux)
compiled by GNU C version 4.0.0 20050301 (prerelease) (Debian
4.0-0pre6ubuntu7).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128479
as -V -Qy --32 -o b.o b.s
GNU assembler version 2.15 (i386-linux) using BFD version 2.15
--
Summary: Explicitly instantiated templates don't seem to be
instantiated
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kinetik at orcon dot net dot nz
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-pc-linux-gnu
GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21118