const char* err() { return "Error in "__FILE__; } With GCC 7 this gave a warning: file.cc:1:28: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] const char* err() { return "Error in "__FILE__; } ^ But GCC 8 now rejects it: 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__; } ^~~~~~~~~~~~~~~~~~~ This was caused by r254443 for PR 80955 I'm not going to add the "rejects-valid" keyword, because technically the code is invalid, but we accept it as an extension because there is no matching UDL.
Patch posted to https://gcc.gnu.org/ml/gcc-patches/2018-02/msg01503.html
Author: redi Date: Wed Feb 28 15:27:17 2018 New Revision: 258069 URL: https://gcc.gnu.org/viewcvs?rev=258069&root=gcc&view=rev Log: PR preprocessor/84517 allow double-underscore macros after string literals gcc/testsuite: PR preprocessor/84517 * g++.dg/cpp0x/udlit-macros.C: Expect a warning for ""__FILE__. libcpp: PR preprocessor/84517 * lex.c (is_macro_not_literal_suffix): New function. (lex_raw_string, lex_string): Use is_macro_not_literal_suffix to decide when to issue -Wliteral-suffix warnings. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp0x/udlit-macros.C trunk/libcpp/ChangeLog trunk/libcpp/lex.c
Fixed