A bug report.
Andrei G. Basov
abasov01@utopia.poly.edu
Thu Dec 3 00:08:00 GMT 1998
The attached program gives me the following when compiled as
g++ -Wall -o t ptof.c++
ptof.c++: In function `void sort<int>()':
ptof.c++:17: Internal compiler error 40.
ptof.c++:17: Please submit a full bug report to `egcs-bugs@cygnus.com'.
The output of g++ -v is
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
[Comment: the basic problem is with the passing of pointer to a template
function without the explicit specification. See the source]
If this was already fixed - I apologize.
Good luck,
--
---DrOn
PS. Drop me a note if you received that message AND didn't send it to /dev/null
#include <stdlib.h>
#include <iostream.h>
template <class T>
int compare(const void *a,const void *b) {
if(*(T*)a==*(T*)b)
return 0;
if (*(T*)a<*(T*)b)
return -1;
return 1;
}
template <class T>
void sort() {
T *buf;
buf=new T[5];
qsort(buf,5,sizeof(T),compare<T>);
delete [] buf;
return;
}
main() {
sort<int>();
}
More information about the Gcc-bugs
mailing list