https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105702
Bug ID: 105702
Summary: Add fix-it for missing nested-name-specifier on
out-of-class assignment operator
Product: gcc
Version: 12.1.1
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
struct A {
A& operator=(const A&);
};
A& operator=(const A&) { return *this; }
ool.C:5:4: error: ‘A& operator=(const A&)’ must be a non-static member function
5 | A& operator=(const A&) { return *this; }
| ^~~~~~~~
The error is good, but it would be even better to suggest that the
qualification is missing:
5 | A& operator=(const A&) { }
| ^
| A::