gcc-2.95 internal error
Martin Bachtold
martinb@coyotesystems.com
Tue Aug 3 08:43:00 GMT 1999
gcc-2.95 told me to send you this error report. Here's the file:
//------------------------------------------------------------------------------------------------------------------
// Input file for internal error in gcc -2.95
class A {
public:
A();
template<class TTItem>
static void f(const TTItem*);
};
A::A() {
void (*function)(const double*) = &f<double>;
}
template<class TTItem>
void A::f(const TTItem* in) {
}
int main(int, char**) {
A a;
return 0;
}
// end of input file
//------------------------------------------------------------------------------------------------------------------
Here's the compilation:
gcc -v --save-temps -o templateTest templateTest.cc
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/specs
gcc version 2.95 19990728 (release)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/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) -
?
GNU CPP version 2.95 19990728 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/../../../../include/g++-3
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/../../../../i686-pc-linux-gnu/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path:
End of omitted list.
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/cc1plus templateTest.ii
-quiet -dumpbase templateTest.cc -version -o templateTest.s
GNU C++ version 2.95 19990728 (release) (i686-pc-linux-gnu) compiled by
GNU C version 2.95 19990728 (release).
templateTest.cc: In method `A::A()':
templateTest.cc:9: Internal compiler error.
templateTest.cc:9: Please submit a full bug report.
templateTest.cc:9: See <URL: http://egcs.cygnus.com/faq.html#bugreport >
for instructions.
//------------------------------------------------------------------------------------------------------------------
Comment:
There is a workaround to make the code work by changing the line
void (*function)(const double*) = &f<double>;
to:
void (*function)(const double*) = &f;
I realize that the submitted snippet may not even be legal C++ source,
but the compiler should even then not produce an internal error.
Regards, Martin.
--
___________________________________________________________________________
Martin Bächtold
Coyote Systems, Inc.
2740 Van Ness Ave. #210, San Francisco, CA 94109
Tel. +1 (415) 346-4223 x14;
Fax. +1 (415) 346-6282; email: martinb@coyotesystems.com
___________________________________________________________________________
More information about the Gcc-bugs
mailing list