aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/StmtPrinter.cpp2
-rw-r--r--test/SemaCXX/constexpr-printing.cpp6
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 6408c879fa..836f192aeb 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -717,7 +717,7 @@ void StmtPrinter::VisitStringLiteral(StringLiteral *Str) {
default:
// FIXME: Is this the best way to print wchar_t?
if (Char > 0xff) {
- // char32_t values are <= 0x10ffff.
+ assert(Char <= 0x10ffff && "invalid unicode codepoint");
if (Char > 0xffff)
OS << "\\U00"
<< Hex[(Char >> 20) & 15]
diff --git a/test/SemaCXX/constexpr-printing.cpp b/test/SemaCXX/constexpr-printing.cpp
index a648fab42e..03768c09fb 100644
--- a/test/SemaCXX/constexpr-printing.cpp
+++ b/test/SemaCXX/constexpr-printing.cpp
@@ -83,7 +83,9 @@ constexpr char c8 = get(u8"test\0\\\"\t\a\b\234"); // \
expected-error {{}} expected-note {{u8"test\000\\\"\t\a\b\234"}}
constexpr char16_t c16 = get(u"test\0\\\"\t\a\b\234\u1234"); // \
expected-error {{}} expected-note {{u"test\000\\\"\t\a\b\234\u1234"}}
-constexpr char32_t c32 = get(U"test\0\\\"\t\a\b\234\u1234\U00101234"); // \
- expected-error {{}} expected-note {{U"test\000\\\"\t\a\b\234\u1234\U00101234"}}
+constexpr char32_t c32 = get(U"test\0\\\"\t\a\b\234\u1234\U0010ffff"); // \
+ expected-error {{}} expected-note {{U"test\000\\\"\t\a\b\234\u1234\U0010FFFF"}}
constexpr wchar_t wc = get(L"test\0\\\"\t\a\b\234\u1234"); // \
expected-error {{}} expected-note {{L"test\000\\\"\t\a\b\234\u1234"}}
+
+constexpr char32_t c32_err = get(U"\U00110000"); // expected-error {{invalid universal character}}