File: string-literal-encoding.c

package info (click to toggle)
llvm-toolchain-3.5 1%3A3.5.2-3~bpo8%2B2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 283,276 kB
  • sloc: cpp: 1,884,580; ansic: 310,787; objc: 86,612; python: 79,608; asm: 65,866; sh: 9,829; makefile: 6,068; perl: 5,589; ml: 5,254; pascal: 3,285; lisp: 1,640; xml: 686; cs: 239; csh: 117
file content (33 lines) | stat: -rw-r--r-- 2,120 bytes parent folder | download | duplicates (41)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// RUN: %clang_cc1 -x c++ -std=c++0x -fsyntax-only -verify %s

// This file should be encoded using ISO-8859-1, the string literals should
// contain the ISO-8859-1 encoding for the code points U+00C0 U+00E9 U+00EE
// U+00F5 U+00FC

void f() {
    wchar_t const *a = L""; // expected-error {{illegal character encoding in string literal}}

    char16_t const *b = u""; // expected-error {{illegal character encoding in string literal}}
    char32_t const *c = U""; // expected-error {{illegal character encoding in string literal}}
    wchar_t const *d = LR"()"; // expected-error {{illegal character encoding in string literal}}
    char16_t const *e = uR"()"; // expected-error {{illegal character encoding in string literal}}
    char32_t const *f = UR"()"; // expected-error {{illegal character encoding in string literal}}

    char const *g = ""; // expected-warning {{illegal character encoding in string literal}}
    char const *h = u8""; // expected-error {{illegal character encoding in string literal}}
    char const *i = R"()"; // expected-warning {{illegal character encoding in string literal}}
}

void g() {
    wchar_t const *a = L"foo "; // expected-error {{illegal character encoding in string literal}}

    char16_t const *b = u"foo "; // expected-error {{illegal character encoding in string literal}}
    char32_t const *c = U"foo "; // expected-error {{illegal character encoding in string literal}}
    wchar_t const *d = LR"(foo )"; // expected-error {{illegal character encoding in string literal}}
    char16_t const *e = uR"(foo )"; // expected-error {{illegal character encoding in string literal}}
    char32_t const *f = UR"(foo )"; // expected-error {{illegal character encoding in string literal}}

    char const *g = "foo "; // expected-warning {{illegal character encoding in string literal}}
    char const *h = u8"foo "; // expected-error {{illegal character encoding in string literal}}
    char const *i = R"(foo )"; // expected-warning {{illegal character encoding in string literal}}
}