Bug: Template functions

Kurt Garloff garloff@kg1.ping.de
Sat Nov 29 16:18:00 GMT 1997


Hi,

I fell across an Internal compiler error:

garloff@kg1:~/numerix/stretch $ pgcc -O2 -o bug bug.cc
bug.cc:7: Internal compiler error 9.
bug.cc:7: Please submit a full bug report to `egcs-bugs@cygnus.com'.

-----------------------------------------------------------
// bug.cc

#include <stdio.h>

template <int n1>
double val <int> ()
{
   return (double) n1;
};

int main ()
{
   printf ("%d\n", val<(int)3> ());
}
------------------------------------------------------------

If a omit the <int> in line 7, I am able to successfully compile it, but
the linker misses val then.

If I have a similar declaration inside a class I get an Internal compiler
error 40.

garloff@kg1:~ $ pgcc -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.17p/specs
gcc version egcs-2.90.17p 971114 (gcc2-970802 experimental)

The FSF gcc (ss-971115) has the same bad behaviour.

Kurt Garloff, Dortmund 
<K.Garloff@ping.de>
PGP key on http://www.student.physik.uni-dortmund.de/homepages/garloff








More information about the Gcc-bugs mailing list