c++/3020: using operator-> within the class that defines it

Artem Khodush artem@duma.gov.ru
Fri Jun 1 03:29:00 GMT 2001


> When operator->() is defined within a class B,
> gcc does not apply it to expressions of the form
> "this->x" from within class B (although it has
> no trouble when the expression is spelled out as
> "this->operator()->x").

Not a bug.
operator->() applies only to objects of the class, not to
pointers to objects. You should write (*this)->x.




More information about the Gcc-bugs mailing list