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

            Bug ID: 96205
           Summary: compile error on: #define JJWIDE(x) L#x
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: francis.andre.kampbell at orange dot fr
  Target Milestone: ---

Hello

The following c++ source bug.cpp does not compile with: g++ -DWIDE_CHAR bug.cpp

#include <iostream>

#ifndef WIDE_CHAR
        #define JAVACC_CHAR_TYPE char
        #define JAVACC_CHAR_TYPE_SIZEOF 1
        #define JJIN  std::cin
        #define JJOUT std::cout
        #define JJERR std::cerr
        #define JJLOG std::cout
        #define JJWIDE(x) #x
#else
        #define JJIN  std::wcin
        #define JJOUT std::wcout
        #define JJERR std::wcerr
        #define JJLOG std::wcout
        #define JJWIDE(x) L#x
#endif

int main(int argc, char**argv) {
        JJOUT << JJWIDE(Hello World!) << std::endl;
        return 0;
}


fandre@ubuntu-18-04:~$ g++ -DWIDE_CHAR bug.cpp
bug.cpp: In function ‘int main(int, char**)’:
bug.cpp:16:20: error: ‘L’ was not declared in this scope
  #define JJWIDE(x) L#x
                    ^
bug.cpp:20:11: note: in expansion of macro ‘JJWIDE’
  JJOUT << JJWIDE(Hello World!) << std::endl;

Reply via email to