Clang Project

clang_source_code/test/CXX/lex/lex.literal/lex.string/p4.cpp
1// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2// expected-no-diagnostics
3
4// NOTE: This file intentionally uses DOS-style line endings to test
5// that we don't propagate them into string literals as per [lex.string]p4.
6
7constexpr const char* p = R"(a\
8b
9c)";
10
11static_assert(p[0] == 'a',  "");
12static_assert(p[1] == '\\', "");
13static_assert(p[2] == '\n', "");
14static_assert(p[3] == 'b',  "");
15static_assert(p[4] == '\n', "");
16static_assert(p[5] == 'c',  "");
17static_assert(p[6] == '\0', "");
18