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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> That this source produces a -Warray-bounds warning is somewhat surprising 
> since it contains no arrays, no array indexing, and no pointer arithmetic

Well techincally there is pointer arithmetic because the pointer to member
function could have a delta for the function call at `(c.*func)();`
Also there is an "array" because all variables/decls are arrays in C++ with a
size of 1 (that allows you do pass &a + 1 as the end for iterators).

Anyways the problem here is the optimizer optimized &g into `(c.*func)();` but
had not optimized the  &MyClass::my_method part yet when the warning happened.

Reply via email to