public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with passing subclass methods are parameters
@ 2001-08-21 11:58 Brent Phillips
  0 siblings, 0 replies; only message in thread
From: Brent Phillips @ 2001-08-21 11:58 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-08-21 11:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-21 11:58 problem with passing subclass methods are 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).