This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
const bug ?
- To: egcs-bugs <egcs-bugs at cygnus dot com>
- Subject: const bug ?
- From: Aleksei Makarov <amakarov at math dot omsu dot omskreg dot ru>
- Date: Mon, 25 May 1998 07:13:41 +0000
- Organization: omsu
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