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

            Bug ID: 91138
           Summary: Confusing error message: "maybe you meant to use '->'
                    ?" fix-it when -> is already used
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #91134 +++

struct X { int member; } x;
X* p = &x;
X** pp = &p;
int i = *pp->member;

91134.cc:4:14: error: request for member 'member' in '* pp', which is of
pointer type 'X*' (maybe you meant to use '->' ?)
    4 | int i = *pp->member;
      |              ^~~~~~


Suggesting -> isn't helpful when it already uses it. The right fix-it is to
suggest (*pp)->member

Reply via email to