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

            Bug ID: 84517
           Summary: [8 Regression] "string literal"__FILE__ no longer
                    accepted
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

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.

Reply via email to