[Bug c++/85875] New: -Weffc++ can't understand auto return values

msharov at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Tue May 22 17:20:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85875

            Bug ID: 85875
           Summary: -Weffc++ can't understand auto return values
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msharov at users dot sourceforge.net
  Target Milestone: ---

struct C {
    struct const_iterator {
        auto& operator++() { return *this; }
    };
};

Compiling with -Weffc++ gives warning:

t.cc:3:24: warning: prefix ‘auto& C::const_iterator::operator++()’
                     should return ‘C::const_iterator&’ [-Weffc++]              

even though auto& evaluates to C::const_iterator&


More information about the Gcc-bugs mailing list