https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77984
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-08-22 CC| |egallager at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Victor Paléologue from comment #0) > Created attachment 39810 [details] > Stand-alone C++ code reproducing a false warning > > In the code attached, Thing::operator= is defined as following: > > struct Thing > { > template<typename T> > Thing& operator=(const T&) > { > return *this; > } > }; > > Compiling it, I get a warning that does not seem legitimate: > > $ g++ false_warning.cpp -Weffc++ > false_warning.cpp: In member function ‘Thing& Thing::operator=(const T&)’: > false_warning.cpp:6:13: warning: ‘operator=’ should return a reference to > ‘*this’ [-Weffc++] > return *this; > ^~~~ > Confirmed. (In reply to Jonathan Wakely from comment #4) > No, but IMHO it should be (unless somebody fixes it, see PR 16166 and PR > 16168 and PR 55837 and others). I'd rather see it fixed; I might give it a try myself once I learn enough c++ to know what I'm doing. In the meantime I'll make a meta-bug to gather all the -Weffc++ bugs together.