Is this legal C++?
Alexandre Oliva
aoliva@cygnus.com
Wed Apr 19 14:20:00 GMT 2000
On Apr 19, 2000, Zack Weinberg <zack@wolery.cumb.org> wrote:
> (this->*C::oper) (x, y);
> Now I find this somewhat surprising. Why doesn't the "implicit this"
> syntactic sugar extend to an implicit ->* for references to
> pointer-to-member-function members?
I don't remember the rationale, but I'm pretty sure draft versions of
the Standard required the explicit use of `this->*' in such cases. I
can't find any such wording in the final Standard, but I don't
remember exactly in which section I (think I :-) had read it, so I may
just not have found it.
> Also, note that G++ insists on the first pair of parentheses;
This is correct, it's a matter of precedence. Without the
parentheses, it would be parsed as
this->*(C::oper (x, y));
which is totally bogus.
--
Alexandre Oliva Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me
More information about the Gcc
mailing list