From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer Dorsch To: egcs@cygnus.com Subject: egcs and pointers to methods / compatibility with gcc 2.7.2 Date: Fri, 08 May 1998 15:42:00 -0000 Message-id: X-SW-Source: 1998-05/msg00294.html I have a program, which compiles without warnings (-Wall) on gcc 2.7.2 and does not compile with egcs. Are there anywhere migration guidlines or a kind of checklist which things are incompatible now? Does anybody know, how I can fix this problem? I include my code, which uses pointers to class methods: #include class testclass{ public: /** Default Constructor. */ testclass(){} /** Destructor. */ ~testclass(){} /** Add numbers. */ int Add(int a, int b){return(Convert(testclass::add, a, b));} /** Sub numbers. */ int Sub(int a, int b){return(Convert(testclass::sub, a, b));} private: /** Debug support. */ int debuglevel; /** Convert. */ int Convert(int (testclass::*Operation)(int, int), int a, int b){ // Do some standard computation ..., // and call the Operation given as paramters return(Operation(a,b)); } /** add. */ int add(int a, int b){return(a+b);} /** sub. */ int sub(int a, int b){return(a-b);} }; /* class testclass */ main() { testclass a; cout << a.Add(5,6) << endl; } The error messages are: $ g++ -Wall test4.cc test4.cc: In method `int testclass::Add(int, int)': test4.cc:12: no matching function for call to `testclass::Convert (int (testclass::)(int, int), int &, int &)' test4.cc:19: candidates are: testclass::Convert(int (testclass::*)(int, int), int, int) test4.cc:12: warning: control reaches end of non-void function `testclass::Add(int, int)' test4.cc: In method `int testclass::Sub(int, int)': test4.cc:14: no matching function for call to `testclass::Convert (int (testclass::)(int, int), int &, int &)' test4.cc:19: candidates are: testclass::Convert(int (testclass::*)(int, int), int, int) test4.cc:14: warning: control reaches end of non-void function `testclass::Sub(int, int)' test4.cc: In method `int testclass::Convert(int (testclass::*)(int, int), int, int)': test4.cc:23: must use .* or ->* to call pointer-to-member function in `Operation (...)' test4.cc:24: warning: control reaches end of non-void function `testclass::Convert(int (testclass::*)(int, int), int, int)' I am using $ g++ -v Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.90.28/specs gcc version egcs-2.90.28 980423 (egcs-1.0.3 prerelease) Thank you. -- Rainer Dorsch Abt. Rechnerarchitektur e-mail:rainer.dorsch@informatik.uni-stuttgart.de Uni Stuttgart Tel.: 0711-7816-215