From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1120 invoked by alias); 14 Jan 2013 15:23:27 -0000 Received: (qmail 1045 invoked by uid 48); 14 Jan 2013 15:22:59 -0000 From: "nachms+gcc at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/55971] New: Preprocessor macros with C++11 raw string literals fail to compile Date: Mon, 14 Jan 2013 15:23:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nachms+gcc at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg01182.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55971 Bug #: 55971 Summary: Preprocessor macros with C++11 raw string literals fail to compile Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor AssignedTo: unassigned@gcc.gnu.org ReportedBy: nachms+gcc@gmail.com It does not seem possible to create a macro which contains a C++ raw string literal, when it should be. Example: ----------------- #include #define CREATE_CLIENTS R"(CREATE TABLE "clients"( "clientId" INTEGER PRIMARY KEY AUTOINCREMENT, "clientName" VARCHAR(64) UNIQUE ))" int main() { std::cout << CREATE_CLIENTS << std::endl; return 0; } ----------------- g++ -W -Wall -o test test.cpp -std=3Dc++11 test.cpp:3:24: error: unterminated raw string test.cpp:6:3: warning: missing terminating " character [enabled by default] test.cpp:6:1: error: missing terminating " character test.cpp:10:3: error: stray =E2=80=98R=E2=80=99 in program test.cpp:4:3: error: expected unqualified-id before string constant On the other hand, clang seems to be able to handle it: clang++ -W -Wall -o test test.cpp -std=3Dc++11 ./test CREATE TABLE "clients"( "clientId" INTEGER PRIMARY KEY AUTOINCREMENT, "clientName" VARCHAR(64) UNIQUE )