[Bug c++/45431] specify the field for initializer-string for array of chars is too long

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 21 17:35:00 GMT 2018


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Because the C front end gets the location info right in recent versions of GCC
it also marks the bad initializer with carets:

bug.c:4:3: warning: initializer-string for array of chars is too long
   "Christopher",
   ^~~~~~~~~~~~~
bug.c:4:3: note: (near initialization for 'sc_me.name')
bug.c:5:3: warning: initializer-string for array of chars is too long
   "Yeleighton" };
   ^~~~~~~~~~~~
bug.c:5:3: note: (near initialization for 'sc_me.surname')

This is ideal, as it shows both the bad initializer, and the field it's trying
to initialize.


More information about the Gcc-bugs mailing list