aboutsummaryrefslogtreecommitdiff
path: root/test/Lexer/string-literal-encoding.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-11-01 02:26:36 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-11-01 02:26:36 +0000
commitf12e1b928053ccec033eee4c1e683bb1c54c220a (patch)
tree9f9bb8cd75fe07474ff130860f59abab8a8784ac /test/Lexer/string-literal-encoding.c
parent64f45a24b19eb89ff88f7c3ff0df9be8e861ac97 (diff)
Tests for UTF-8 encoding in strings in source code. Patch by Seth Cantrell.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143418 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Lexer/string-literal-encoding.c')
-rw-r--r--test/Lexer/string-literal-encoding.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Lexer/string-literal-encoding.c b/test/Lexer/string-literal-encoding.c
new file mode 100644
index 0000000000..de28af2b4c
--- /dev/null
+++ b/test/Lexer/string-literal-encoding.c
@@ -0,0 +1,15 @@
+// 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 sequence in string literal }}
+
+ char16_t const *b = u"Àéîõü"; // expected-error {{ illegal sequence in string literal }}
+ char32_t const *c = U"Àéîõü"; // expected-error {{ illegal sequence in string literal }}
+ wchar_t const *d = LR"(Àéîõü)"; // expected-error {{ illegal sequence in string literal }}
+ char16_t const *e = uR"(Àéîõü)"; // expected-error {{ illegal sequence in string literal }}
+ char32_t const *f = UR"(Àéîõü)"; // expected-error {{ illegal sequence in string literal }}
+}