https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93490
--- Comment #6 from Cristian Morales Vega <christian.morales.vega at gmail dot com> --- Yes, ------------------ struct Class1 { int member_; }; int &f(Class1 *a) { return a->member_; } ------------------ also generates the warning. This is a bug, right? I'm basing this issue on https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes saying "Note that a function that has pointer arguments and examines the data pointed to must not be declared const if the pointed-to data might change between successive invocations of the function."