https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103996
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-01-12 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Simplified testcase: void f(void); int main(void) { f[0] = 0; } The C++ front-end for the above testcase produces: <source>: In function 'int main()': <source>:4:8: warning: pointer to a function used in arithmetic [-Wpointer-arith] 4 | f[0] = 0; | ^ <source>:4:10: error: assignment of read-only location '* f' 4 | f[0] = 0; | ~~~~~^~~ For a slightly different one: void f(void); void f(int); int main(void) { f[0] = 0; } The C++ fornt-end produces similar to what was done in the index case.