This is the mail archive of the
mailing list for the GCC project.
passing subclass methods as parameters
- To: gcc at gcc dot gnu dot org
- Subject: passing subclass methods as parameters
- From: Brent Phillips <brent at lyrastudios dot com>
- Date: Wed, 22 Aug 2001 20:40:05 -0700
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
* note: GsForwardThread is a public subclass of LmThread
where the offensive line is
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 pointer parameter passing breaks...
thanks so much!