This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
internal compiler error concerning templates
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: internal compiler error concerning templates
- From: Malte Knoerr <malte at knoerr dot escape dot de>
- Date: Tue, 7 Mar 2000 15:15:48 +0100
Hi,
the following code causes this error (egcs-2.91.66 on SuSE 6.3/Intel):
g++ -v --save-temps template.cpp
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
/usr/lib/gcc-lib/i486-linux/egcs-2.91.66/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i486__ template.cpp template.ii
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++
/usr/lib/g++-include
/usr/local/include
/usr/i486-linux/include
/usr/lib/gcc-lib/i486-linux/egcs-2.91.66/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i486-linux/egcs-2.91.66/cc1plus template.ii -quiet -dumpbase template.cc -version -o template.s
GNU C++ version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i486-linux) compiled by GNU C version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
template.cpp:8: Internal compiler error.
template.cpp:8: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
template.cpp:8: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.
Btw, this URL is not valid, http://gcc.gnu.org/bugs.html is correct.
----
template <class T>
T max(T a, T b)
{
return a > b ? a : b;
}
//template <class T>
T min(T a, T b)
{
return a < b ? a : b;
//}
int main(void)
{
int x = max (1,2);
double y = min (0.1,0.2);
}
----
I know that the code is not correct, but the compiler should give a more usefull
message :-)
Thanks,
Malte
# 1 "template.cpp"
template <class T>
T max(T a, T b)
{
return a > b ? a : b;
}
T min(T a, T b)
{
return a < b ? a : b;
int main(void)
{
int x = max (1,2);
double y = min (0.1,0.2);
}