const bug ?
Aleksei Makarov
amakarov@math.omsu.omskreg.ru
Mon May 25 00:52:00 GMT 1998
Hello!
Compiling this code
-----------------
#include <stdio.h>
class a {
public:
int f() { printf(" non-const\n"); return 0;}
int f() const { printf(" const\n" ); return 0;}
};
class b : public a {
};
int main() {
int (b::* ptr1)() = &b::f; // <- 13
int (b::* ptr2)() const = &b::f; // <- 14
b ao;
printf("non-const : ");
(ao.*ptr1)();
printf(" const : ");
(ao.*ptr2)();
return 0;
}
---------------
I get error message:
---------------
test5.cc: In function `int main()':
test5.cc:13: ambiguous overload for overloaded method requested
test5.cc:14: ambiguous overload for overloaded method requested
----------------
but TenDRA and Borland C 4.5 are happy with it.
I think this is a bug in egcs (and gcc).
--
A. Makarov, OmSU
More information about the Gcc-bugs
mailing list