This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/84892] New: Missing accessor hint for private field


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

            Bug ID: 84892
           Summary: Missing accessor hint for private field
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

Reddit user "evaned" reports that we fail to offer a fix-it hint code
suggesting the "get_field" accessor on this code:
https://godbolt.org/g/y2cbuv


class S {
private:
    bool field;

public:
    bool get_field() const {
        return field;
    }
};

bool thingy(const S & s) {
  return s.field;
}


Removing the "const" from "thingy" seems to fix it.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]