https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96518
Bug ID: 96518 Summary: g++ suggests a weird function when there's a lowercase mistake Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: albert.astals.cid at kdab dot com Target Milestone: --- With the code class Foo { public: void SetParent(Foo *f) { parent = f; } Foo *GetParent() { return parent; } Foo *parent = nullptr; }; int main(int argc, char **argv) { Foo f; Foo f2; Foo *f3 = f.getParent(); } g++ tells me main.cpp: In function ‘int main(int, char**)’: main.cpp:21:17: error: ‘class Foo’ has no member named ‘getParent’; did you mean ‘SetParent’? 21 | Foo *f3 = f.getParent(); | ^~~~~~~~~ | SetParent I find it weird that it recommends SetParent instead of GetParent given that GetParent is closer lexycographically (and that one actually returns a Foo * and the other doesn't)