Bad overload resolution

Bill Currie
Sun Aug 2 15:31:00 GMT 1998

Using the attached file, gcc gives me the following (incorrect) output:
[bcurrie@nzlc01 ~]
$ gcc -O2 -S -v
Reading specs from
gcc version egcs-2.92.00 19980715 (gcc2 ss-980609 experimental)
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=92 -Dhppa -Dunix -D_FTX -D__hppa__ -D__unix__ -D_FTX
-D__hppa -D__unix -Asystem(unix) -Acpu(hppa) -Amachine(hppa)
GNU CPP version egcs-2.92.00 19980715 (gcc2 ss-980609 experimental)
#include "..." search starts here:
#include <...> search starts here:

End of search list.

/var/tmp/cc5MPBB8.ii -quiet -dumpbase -O2 -version -o
GNU C++ version egcs-2.92.00 19980715 (gcc2 ss-980609 experimental)
(hppa1.1-stratus-sysv4) compiled by GNU C version In method `foobar::foobar()': warning: assuming & on `foobar::callback()' warning: converting from `void (foobar::*)()' to `void
(*)(void *)'

If I reverse the two callback definitions, everything is fine and the
correct address is passed to `func'.

In the file where I first encountered this problem, I actually got an
error, but that was probably because `func' was overloaded as well, but
reversing the declarations of the callback function fixed it.  I also
checked the 19980730 version and had the same problem.

I take it that overloaded function resoltion for taking the address of a
function is not meant to be dependent on the order of definitions.  This
has always worked for me before (<=, first time I tried building
this particular program with egcs).

Leave others their otherness

More information about the Gcc-bugs mailing list