* egcs and pointers to methods / compatibility with gcc 2.7.2
@ 1998-05-08 15:42 Rainer Dorsch
1998-05-09 13:21 ` Alexandre Oliva
0 siblings, 1 reply; 2+ messages in thread
From: Rainer Dorsch @ 1998-05-08 15:42 UTC (permalink / raw)
To: egcs
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 <iostream.h>
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-05-09 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-08 15:42 egcs and pointers to methods / compatibility with gcc 2.7.2 Rainer Dorsch
1998-05-09 13:21 ` Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).