ICE on address of template function

Wolfgang Bangerth Wolfgang.Bangerth@IWR.Uni-Heidelberg.De
Tue Jun 22 01:04:00 GMT 1999


Hi there,

this is easily solved by applying the correct syntax, but I thought I'd
let you know about an ICE on incorrect syntax anyway. This is with the
2.95 snapshot of 1999-06-15. The code in question is:
--------------------------------------------------------
template <typename number, typename Compare>
void foo (number, Compare);

struct X {
  template <typename number>  static bool check (const number x1);
  void test ();
};


void X::test () 
{
  float a;

//  foo (a, &X::check);                 // no matching function
    foo (a, &X::check<float>);          // internal compiler error
//  foo (a, &check);                    // address of non-static member function
//  foo (a, &check<float>);             // internal compiler error
//  foo (a, &X::template check<float>); // ok
//  foo (a, &template check<float>);    // parse error
};
--------------------------------------------------------
Depending on which line you comment out, you get the different error
messages. The original question arose because I wanted to omit the scope
qualification X:: because we are in that scope. egcs 1.1.2 by the way
accepted line 4 which now gives an ICE. The error message of line 3 is
particularly misleading since I didn't request a static function's
address, the template parameter of 'foo' should take everything.

Anyway, many thanks for egcs! As long as ICE's can be resolved as simple
as here (by writing the correct syntax) I am happy to accept them, and I
found there to be very few on correct code. Great!

Best regards
  Wolfgang

-------------------------------------------------------------------------
Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                             www: http://gaia.iwr.uni-heidelberg.de/~wolf




-OUTPUT---------------------------------------
deal.II/source> c++ -c basic/a.cc -o /dev/null
basic/a.cc: In method `void X::test()':
basic/a.cc:15: Internal compiler error.
basic/a.cc:15: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
basic/a.cc:15: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for  details.

-VERSION--------------------------------------
deal.II/source> c++ -v
Reading specs from
/usr/local/gcc/egcs-ss-19990616/lib/gcc-lib/sparc-sun-solaris2.6/gcc-2.95/specs
gcc version gcc-2.95 19990615 (prerelease)





More information about the Gcc-bugs mailing list