[Bug c++/93490] -Wsuggest-attribute=const suggests const attribute for non-static member function
christian.morales.vega at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 29 16:53:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93490
--- Comment #3 from Cristian Morales Vega <christian.morales.vega at gmail dot com> ---
This seems to show the issue: https://godbolt.org/z/-VRgtF
class Class1 {
public:
auto member() -> int&
#ifdef INLINE
{
return member_;
}
#else
;
#endif
private:
int member_;
};
#ifndef INLINE
auto Class1::member() -> int& { return member_; }
#endif
extern Class1 obj1;
extern Class1 obj2;
int main() {
auto value = obj1.member();
auto value2 = obj2.member();
return value + value2;
}
With "INLINE" defined there is no warning.
More information about the Gcc-bugs
mailing list