http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53843

             Bug #: 53843
           Summary: Macros following string literals don't expand in C++11
                    mode
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: joseph.h.gar...@gmail.com


The following works in C++98 and C++11 mode in GCC 4.4 and in C++98 mode in GCC
4.7 but breaks in C++11 mode in GCC 4.7:

#include <iostream>

#define bar
#define FOO "x"bar

int main()
{
  std::cout << FOO << std::endl;

  return 0;
}

The error given is:

pptest.cpp: In function ‘int main()’:
pptest.cpp:8:16: error: unable to find string literal operator ‘operator"" bar’

AFAIK this is not correct behavior. I wouldn't expect the preprocessor behavior
to change based on custom string literals being added to the language, but I
haven't been able to find anything either way by Googling. I think the bar to
expand to nothing so that just "x" is printed.

Reply via email to