This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/84892] New: Missing accessor hint for private field
- From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 15 Mar 2018 22:26:32 +0000
- Subject: [Bug c++/84892] New: Missing accessor hint for private field
- Auto-submitted: auto-generated
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.