This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
problem with passing subclass methods are parameters
- To: gcc-help at gcc dot gnu dot org
- Subject: problem with passing subclass methods are parameters
- From: Brent Phillips <brent at lyrastudios dot com>
- Date: Tue, 21 Aug 2001 11:56:30 -0700
Hi,
I'm having some difficulty in getting code that works great with version
2.96 to work proprerly with version 3.0. I'm using g++ on RedHat Linux
with a 2.2 kernel.
Specifically, the compiler will no longer let me pass methods of a subclass
of class A where a class A method is required. So, for a typedef FOO of the
form
typedef void (A::*FOO)(void);
where A is a class and B is a subclass of A, I can not pass methods of
class B to functions requiring a parameter of type FOO.
More specifics below; the only options of note are -g2 and -W, and the
exact compiler message is:
GsForwardThread.cpp:247: no matches converting function `handle_SMsg_Ping' to
type `void (class LmThread::*)(class LmSrvMesgBuf*, class LmConnection*)'
GsForwardThread.h:50: candidates are: void
GsForwardThread::handle_SMsg_Ping(LmSrvMesgBuf*, LmConnection*)
where the offensive line is
REGISTER(SMsg::PING, (GsForwardThread::handle_SMsg_Ping));
and REGISTER is
#define REGISTER(mtype, handler) RegisterHandler(mtype,
(MsgHandler)&(handler))
and MsgHandler is
typedef void (LmThread::*MsgHandler)(LmSrvMesgBuf* msgbuf, LmConnection*
conn);
and GsForwardThread is a subclass of LmThread:
class GsForwardThread : public LmThread
Any thoughts on what to try to get this to compile? It seems every time I
upgrade gcc, the method parameter passing breaks....
thanks so much!
Brent