https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91134

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Emil Fihlman from comment #0)
> fiesh on #gcc@Freenode gave these ideas regarding this:
> 
> 2019-07-10 18:11:03 +0300 < fiesh> I think that `server->thing` is probably
> replaced by `(*server.thing)` since they are semantically equivalent at some
> stage before the error is produced
> 2019-07-10 18:11:45 +0300 < fiesh> then the parser sees that *server is a
> pointer type and you're trying to access its contents with ., so it tells
> you that doesn't work
> 2019-07-10 18:12:52 +0300 < fiesh> by ((*server).thing)

No I don't think that's what happens.

I think the error is given for any class member access expression where the
object expression has pointer type, i.e. `server->thing` is a member access
expression, and `server` is a pointer, so it gives that error.

What needs to happen is to check whether -> is already used, and in that case
suggest dereferencing the object expression first, i.e. `(*server)->thing`

Reply via email to