r202534 - Tests for lexing of digit separators versus UCNs.

Richard Smith richard-llvm at metafoo.co.uk
Fri Feb 28 12:13:19 PST 2014


Author: rsmith
Date: Fri Feb 28 14:13:19 2014
New Revision: 202534

URL: http://llvm.org/viewvc/llvm-project?rev=202534&view=rev
Log:
Tests for lexing of digit separators versus UCNs.

Modified:
    cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp

Modified: cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp?rev=202534&r1=202533&r2=202534&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp (original)
+++ cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp Fri Feb 28 14:13:19 2014
@@ -43,3 +43,23 @@ static_assert(__LINE__ == 123456, "");
 #define M(x, ...) __VA_ARGS__
 constexpr int x = { M(1'2,3'4) };
 static_assert(x == 34, "");
+
+namespace UCNs {
+  // UCNs can appear before digit separators but not after.
+  int a = 0\u1234'5; // expected-error {{invalid suffix '\u1234'5' on integer constant}}
+  int b = 0'\u12345; // '; // expected-error {{expected ';'}}
+  constexpr int c {M(0\u1234'0,0'1)};
+  constexpr int d {M(00'\u1234,0'1)};
+  static_assert(c == 1, "");
+  static_assert(d == 0, "");
+}
+
+namespace UTF8 {
+  // extended characters can appear before digit separators but not after.
+  int a = 0ሴ'5; // expected-error {{invalid suffix 'ሴ'5' on integer constant}}
+  int b = 0'ሴ5; // '; // expected-error {{expected ';'}}
+  constexpr int c {M(0ሴ'0,0'1)};
+  constexpr int d {M(00'ሴ,0'1)};
+  static_assert(c == 1, "");
+  static_assert(d == 0, "");
+}





More information about the cfe-commits mailing list