* problems passing subclass methods as function pointer parameters
@ 2001-08-22 19:09 Brent Phillips
0 siblings, 0 replies; only message in thread
From: Brent Phillips @ 2001-08-22 19:09 UTC (permalink / raw)
To: gcc-help
Hi,
I'm having some difficulty in getting code that works great with version
2.96 to compile with version 3.0. I'm using g++ on RedHat Linux with a 2.2
kernel. I posted here before and got no response, so I've tried to rephrase
and clarify the issue below.
Specifically, the compiler will no longer allow passing of methods of a
subclass where a the function pointer prototype specifies a method of the
superclass. So, for a typedef FOO of the form
typedef void (SUPERCLASS::*FOO)(void);
I can not pass methods of class SUBCLASS (where SUBCLASS is a public
subclass of SUPERCLASS) 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*)
* note: GsForwardThread is a public subclass of LmThread
where the offensive line is
RegisterHandler(mtype, (MsgHandler)&(GsForwardThread::handle_SMsg_Ping)))
and the (method pointer) type MsgHandler is
typedef void (LmThread::*MsgHandler)(LmSrvMesgBuf* msgbuf, LmConnection*
conn);
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-08-22 19:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-22 19:09 problems passing subclass methods as function pointer parameters Brent Phillips
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).