[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 11:38:00 GMT 2018


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This causes a regression for:

const char* err() { return "Error in "__FILE__; }


file.cc: In function ‘const char* err()’:
file.cc:1:28: error: unable to find string literal operator
‘operator""__FILE__’ with ‘const char [10]’, ‘long unsigned int’ arguments
 const char* err() { return "Error in "__FILE__; }
                            ^~~~~~~~~~~~~~~~~~~

With GCC 7 this gave a warning about not finding a literal operator, and then
continued as the author intended, i.e. concatenating the two strings.


More information about the Gcc-bugs mailing list