From: Rainer Dorsch <rainer@rainer.informatik.uni-stuttgart.de>
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 [thread overview]
Message-ID: <m0yXs0u-000HVqC@rainer.informatik.uni-stuttgart.de> (raw)
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
next reply other threads:[~1998-05-08 15:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-05-08 15:42 Rainer Dorsch [this message]
1998-05-09 13:21 ` Alexandre Oliva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m0yXs0u-000HVqC@rainer.informatik.uni-stuttgart.de \
--to=rainer@rainer.informatik.uni-stuttgart.de \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).