[Bug c++/80955] Macros expanded in definition of user-defined literals
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 22 17:09:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80955
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Testing this:
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1903,7 +1903,7 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token,
const uchar *base,
literal thus breaking the program.
Try to identify macros with is_macro. A warning is issued.
The macro name should not start with '_' for this warning. */
- if ((*cur != '_') && is_macro (pfile, cur))
+ if ((*cur != '_' || cur[1] == '_') && is_macro (pfile, cur))
{
/* Raise a warning, but do not consume subsequent tokens. */
if (CPP_OPTION (pfile, warn_literal_suffix) &&
!pfile->state.skipping)
@@ -2034,7 +2034,7 @@ lex_string (cpp_reader *pfile, cpp_token *token, const
uchar *base)
literal thus breaking the program.
Try to identify macros with is_macro. A warning is issued.
The macro name should not start with '_' for this warning. */
- if ((*cur != '_') && is_macro (pfile, cur))
+ if ((*cur != '_' || cur[1] == '_') && is_macro (pfile, cur))
{
/* Raise a warning, but do not consume subsequent tokens. */
if (CPP_OPTION (pfile, warn_literal_suffix) &&
!pfile->state.skipping)
More information about the Gcc-bugs
mailing list