[Bug c/110654] inconsistent error message in presence of unexpected encoded characters
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 13 15:41:02 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110654
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
libccp has:
/* In C++, this is an error for invalid character in an identifier
because logically, the UTF-8 was converted to a UCN during
translation phase 1 (even though we don't physically do it that
way). In C, this byte rather becomes grammatically a separate
token. */
if (CPP_OPTION (pfile, cplusplus))
cpp_error (pfile, CPP_DL_ERROR,
"extended character %.*s is not valid in an identifier",
(int) (*pstr - base), base);
else
{
*pstr = base;
return false;
}
So this is due to differences in the languages themselves rather than due to C
vs C++ front-end ...
More information about the Gcc-bugs
mailing list