https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85802
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Try adding sizeof (char*) instead. Note the reason why it does not complain in c is because buf is a vla in c while is a standard array in c++. Const is treated differently in the languages.