https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84364
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- // PR c++/84364 // { dg-do compile } // { dg-options "-Weffc++" } template <typename T> struct A { A &operator=(A<T>&& f) { return *this; // { dg-bogus "should return a reference to" } } }; is enough to reproduce this.