This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

template typecast failure


I get an internal compiler error when compiling the following piece of
code.

template<class T>
void proc(void* f, T t)
{
  ((double(*)(...))f)();
}

int main()
{
  int i;
  proc(0,i);  // the 0 is to be replaced by a function
  return 0;
}


It also fails with 'double' replaced by 'float'. It does work with
'double' replaced by 'int', or when the template is replaced by a true
function.


This happens on Linux:
Red Hat Linux release 5.1 (Manhattan)
Kernel 2.0.34 on an i586

> c++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/specs

gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)

> c++ -o atest atest.cc
atest.cc: In function `void proc<int>(void *, int)':
atest.cc:5: Internal compiler error.
atest.cc:5: Please submit a full bug report to `egcs-bugs@cygnus.com'.

It also fails with 'double' replaced by 'float'. It does work with
'double' replaced by 'int', or when the template is replaced by a true
function.

gcc 2.7.2.3 did not have this problem, gcc 2.8.1 has the same problem.

--
Marco Beijersbergen

Astrophysics Division, Space Science Department
European Space Research and Technology Center, European Space Agency
PO Box 299, 2200 AG Noordwijk, The Netherlands
Tel. +31 71 5654751 Fax 4690
mailto:mbeijers@astro.estec.esa.nl http://astro.estec.esa.nl





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]