This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/3020: using operator-> within the class that defines it
- To: <mps at sonartech dot com dot au>
- Subject: Re: c++/3020: using operator-> within the class that defines it
- From: "Artem Khodush" <artem at duma dot gov dot ru>
- Date: Fri, 1 Jun 2001 14:23:10 +0400
- >Received: from artem by mailsrv.duma.gov.ru (SMI-8.6/SMI-SVR4)id OAA22452; Fri, 1 Jun 2001 14:26:04 +0400
- Cc: <gcc-gnats at gcc dot gnu dot org>, <gcc-bugs at gcc dot gnu dot org>
- References: <20010601041013.23865.qmail@sourceware.cygnus.com>
> 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.