This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

const bug ?


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





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]