This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Pointer-to-member Strange behaviour


Benoit Lavigne writes:

> The following code won't compile, and I can't figure out why...

>   ptm fn; // pointer to member function
>   int Execute() {
>     return (d_mgr_p->*fn);

If you intend to call invoke the member function, you must add parens:
      return (d_mgr_p->*fn());

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]