Bug ID: 84364
           Summary: [8 Regression] -Weffc++ warns on "return *this" in
                    template after r253599
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot
          Reporter: dmalcolm at gcc dot
  Target Milestone: ---

Created attachment 43405

This downstream bug report:
describes a false positive from -Weffc++ on the attached code.

I extended the reproducer to cover the 4 combinations of template vs
non-template and lvalue-reference (&) vs rvalue-reference (&&).

It appears to only affect the template cases.

../../src/rhbz1544675.C: In member function ‘t1<T>& t1<T>::operator=(t1<T>&&)’:
../../src/rhbz1544675.C:6:13: warning: ‘operator=’ should return a reference to
‘*this’ [-Weffc++]
     return *this;
../../src/rhbz1544675.C: In member function ‘t3<T>& t3<T>::operator=(t3<T>&)’:
../../src/rhbz1544675.C:19:13: warning: ‘operator=’ should return a reference
to ‘*this’ [-Weffc++]
     return *this;

It seems to have started with r253599.

Reply via email to