diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-02-28 20:13:19 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-02-28 20:13:19 +0000 |
| commit | 86b86973c7f490662342ce086a0c4496f4d23974 (patch) | |
| tree | ba86be8bd291250559b0f12282b096c73f53cde9 /clang/test/Lexer | |
| parent | 35ddad07232f0fd3b5ba637983ac8eb45e457b75 (diff) | |
| download | bcm5719-llvm-86b86973c7f490662342ce086a0c4496f4d23974.tar.gz bcm5719-llvm-86b86973c7f490662342ce086a0c4496f4d23974.zip | |
Tests for lexing of digit separators versus UCNs.
llvm-svn: 202534
Diffstat (limited to 'clang/test/Lexer')
| -rw-r--r-- | clang/test/Lexer/cxx1y_digit_separators.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Lexer/cxx1y_digit_separators.cpp b/clang/test/Lexer/cxx1y_digit_separators.cpp index df0c2624616..dcfb6d093fe 100644 --- a/clang/test/Lexer/cxx1y_digit_separators.cpp +++ b/clang/test/Lexer/cxx1y_digit_separators.cpp @@ -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, ""); +} |

