internal compiler error: in cp_build_indirect_ref, at cp/typeck.c:2779
gcc-mingw version 4.5.0
This is the second time I get this error message; last time this error message simply disappeared after some time, but this time I was able to isolate the error.
Am I the only one who is getting this strange error? And where the "cp/typechk.cpp" file is?
Also, a typedef isn't to be treated as a preprocessor directive. A typedef is for types, virtual FP get_fn(); should be interpreted as creating a virtual method pointer (!) as a member.
I'm pretty sure you're calling the function wrong. Maybe you're not supposed to get an internal compiler error, but I would imagine you would get some kind of error.
I think the right way to do it is like this:
1 2 3 4 5 6 7 8
// ex->get_fn()->*(1); // bad
// good:
(ex->*get_fn())(1);
// also good:
FP fp = get_fn();
(ex->*fp)(1);
Note that the parenethesis there are not superfluous. They are important.
Also note that I didn't actually test this so I might be wrong =x
Try it out and see.
Anyway this is one of the many reasons I avoid function pointers like the plague.