This is the mail archive of the gcc-bugs@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: none


Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:

> class Graphics; typedef void (Graphics::*Meth_ptr) (int,int);
> struct Graphics { Meth_ptr SwitchMode; };
> void bla() { Graphics g; g.SwitchMode (1,1); }

> (egcs-1.0.2 release).
> foo.cc:12: Internal compiler error.
> foo.cc:12: Please submit a full bug report to `egcs-bugs@cygnus.com'.

egcs 1.1 says:

/home/msc/oliva/test.cc: In function `void bla()':
/home/msc/oliva/test.cc:12: pointer-to-member function g.Graphics::SwitchMode cannot be called
/home/msc/oliva/test.cc:12: without an object; consider using .* or ->*

Rewriting:

void bla() { Graphics g; (g.*g.SwitchMode)(1,1); }

Results in correct compilation.

-- 
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]