[Bug c++/69683] New: multiline raw string R"()" for C++11 warning in false #ifdef when -std=c++98
jcrada at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Feb 5 03:42:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69683
Bug ID: 69683
Summary: multiline raw string R"()" for C++11 warning in false
#ifdef when -std=c++98
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jcrada at gmail dot com
Target Milestone: ---
Created attachment 37590
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37590&action=edit
A test file
WHEN using a raw string `R"()"` within an `#ifdef X`
AND the given definition `X` is not defined
AND compiling with `-std=c++98`
THEN the compiler emits `warning: missing terminating " character` for the
string
BUT it is expected from the compiler to ignore everything within the `#ifdef`
because `X` was not defined.
REPLICATE:
gcc-6 -lstdc++ test.cpp -std=c++98
test.cpp:6:22: warning: missing terminating " character
std::string x = R"(My
^
test.cpp:8:20: warning: missing terminating " character
String)";
^
`test.cpp` is shown below and it is attached too.
SYSTEM:
MacOSX Capitan 10.11.3 (15D21)
gcc-6 (Homebrew gcc6 6-20160110) 6.0.0 20160110 (experimental)
test.cpp:
`#include <iostream>
int main(int argc, char** argv){
#ifdef CPP11
std::string x = R"(My
C++11
String)";
#else
std::string x = "My C++98 String";
#endif
std::cout << x << std::endl;
return 0;
}`
More information about the Gcc-bugs
mailing list