[EMAIL PROTECTED] tmp]cat test.cc template <typename T> class Base { static int foo; };
template<> int Base<int>::foo; template<> int Base<float>::foo = 0; [EMAIL PROTECTED] tmp]g++ -c test.cc [EMAIL PROTECTED] tmp]nm --demangle test.o 0000000000000000 B Base<float>::foo [EMAIL PROTECTED] tmp]g++ -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3) For some reason, Base<int>::foo is not emitted. I've tested it with 3.4.6, 4.0.2, 4.3.0 and 4.3.2 as well, and it's broken on all of them. The 4.0.2 and 4.3.0 gccs were i686-cygwin-hosted i686-freebsd6-targeted cross-compilers, so it's not specific to x86_64-linux-gnu. -- Summary: static variables of template class not emitted if no initializer given Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rysto32 at gmail dot com GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37972