Internal compiler error for member templates after call point
Tore Skjellnes
torsk@elkraft.ntnu.no
Sat Apr 15 09:35:00 GMT 2000
Hello,
the following example code should reproduce the bug (v2.95/v2.95.2-i686):
---------- [provoke.cc]:
class Foo
{
public:
// template <typename T> T baz(T p) { return p+1; }
int bar() { return baz(1); }
template <typename T> T baz(T p) { return p+1; }
};
//template <typename T> T Foo::baz(T p) { return p+1; }
----------
Compiling on my i686 linux 2.2.13-rtl2.0 (realtime-linux) system, and a
similar linux system produces a internal compiler error with gcc-2.95
(both gcc 2.95 and 2.95.3 prerelease):
----------
[torsk@milkytoast paramdb]$ gcc -v --save-temps -c provoke.cc
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/cpp -lang-c++ -v -D__GNUC__=2
-D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__
-Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux
-Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386
-D__i386__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__
provoke.cc provoke.ii
GNU CPP version 2.95.3 19991030 (prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/../../../../include/g++-3
/usr/local/include
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/../../../../i586-mandrake-linux/include
End of omitted list.
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/cc1plus provoke.ii -quiet
-dumpbase provoke.cc -version -o provoke.s
GNU C++ version 2.95.3 19991030 (prerelease) (i586-mandrake-linux)
compiled by GNU C version 2.95.3 19991030 (prerelease).
provoke.cc: In method `int Foo::baz<int>(int)':
provoke.cc:5: instantiated from here
provoke.cc:6: Internal compiler error.
provoke.cc:6: Please submit a full bug report.
provoke.cc:6: See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport >
for instructions.
-------
The provoke.ii is not included as it is essetially the same as the source
file (no #includes neccessary). The commented lines both seem to produce
the right code.
The same code seems to compile on gcc2.8.1 on a sparc-sun-solaris2 system:
-------
jeeves:~$ gcc -c -v --save-temps provoke.cc
Reading specs from /store/lib/gcc-lib/sparc-sun-solaris2/2.8.1/specs
gcc version 2.8.1
/store/lib/gcc-lib/sparc-sun-solaris2/2.8.1/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=8 -Dsparc -Dsun
-Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__
-D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4)
-D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)
provoke.cc provoke.ii
GNU CPP version 2.8.1 (sparc)
#include "..." search starts here:
#include <...> search starts here:
/store/include/g++
/store/lib/g++-include
/store/include
/store/sparc-sun-solaris2/include
/store/lib/gcc-lib/sparc-sun-solaris2/2.8.1/include
/usr/include
End of search list.
/store/lib/gcc-lib/sparc-sun-solaris2/2.8.1/cc1plus provoke.ii -quiet
-dumpbase provoke.cc -version -o provoke.s
GNU C++ version 2.8.1 (sparc-sun-solaris2) compiled by GNU C version
2.8.1.
/usr/ccs/bin/as -V -Qy -s -o provoke.o provoke.s
/usr/ccs/bin/as: WorkShop Compilers 5.0 Alpha 03/27/98 Build
-------
It also compiles on a mips-sgi-irix6.2 (v2.8.1) system.
--
Tore Skjellnes, torsk@elkraft.ntnu.no
More information about the Gcc-bugs
mailing list