diff options
Diffstat (limited to 'test/CodeGen/char-literal.c')
-rw-r--r-- | test/CodeGen/char-literal.c | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/test/CodeGen/char-literal.c b/test/CodeGen/char-literal.c index 5963ede..237d4b2 100644 --- a/test/CodeGen/char-literal.c +++ b/test/CodeGen/char-literal.c @@ -9,11 +9,26 @@ int main() { // CHECK-CPP0X: store i8 97 char a = 'a'; - // Should pick second character. + // Should truncate value (equal to last character). // CHECK-C: store i8 98 // CHECK-CPP0X: store i8 98 char b = 'ab'; + // Should get concatenated characters + // CHECK-C: store i32 24930 + // CHECK-CPP0X: store i32 24930 + int b1 = 'ab'; + + // Should get concatenated characters + // CHECK-C: store i32 808464432 + // CHECK-CPP0X: store i32 808464432 + int b2 = '0000'; + + // Should get truncated value (last four characters concatenated) + // CHECK-C: store i32 1919512167 + // CHECK-CPP0X: store i32 1919512167 + int b3 = 'somesillylongstring'; + // CHECK-C: store i32 97 // CHECK-CPP0X: store i32 97 wchar_t wa = L'a'; @@ -27,25 +42,24 @@ int main() { // CHECK-CPP0X: store i16 97 char16_t ua = u'a'; - // Should pick second character. - // CHECK-CPP0X: store i16 98 - char16_t ub = u'ab'; - // CHECK-CPP0X: store i32 97 char32_t Ua = U'a'; - // Should pick second character. - // CHECK-CPP0X: store i32 98 - char32_t Ub = U'ab'; -#endif + // CHECK-CPP0X: store i16 1047 + char16_t ua1 = u'З'; + // CHECK-CPP0X: store i16 12538 + char16_t ua2 = u'ヺ'; + // CHECK-CPP0X: store i16 -27177 + char16_t ua3 = u'闗'; - // Should pick last character and store its lowest byte. - // This does not match gcc, which takes the last character, converts it to - // utf8, and then picks the second-lowest byte of that (they probably store - // the utf8 in uint16_ts internally and take the lower byte of that). - // CHECK-C: store i8 48 - // CHECK-CPP0X: store i8 48 - char c = '\u1120\u0220\U00102030'; + // CHECK-CPP0X: store i32 181 + char32_t Ua1 = U'µ'; + // CHECK-CPP0X: store i32 38359 + char32_t Ua2 = U'闗'; + // CHECK-CPP0X: store i32 128128 + char32_t Ua3 = U'💀'; + +#endif // CHECK-C: store i32 61451 // CHECK-CPP0X: store i32 61451 @@ -65,13 +79,6 @@ int main() { wchar_t wd = L'\U0010F00B'; #if __cplusplus >= 201103L - // Should take lower word of the 4byte UNC sequence. This does not match - // gcc. I don't understand what gcc does (it looks like it converts to utf16, - // then takes the second (!) utf16 word, swaps the lower two nibbles, and - // stores that?). - // CHECK-CPP0X: store i16 -4085 - char16_t ud = u'\U0010F00B'; // has utf16 encoding dbc8 dcb0 - // CHECK-CPP0X: store i32 1110027 char32_t Ud = U'\U0010F00B'; #endif @@ -80,14 +87,4 @@ int main() { // CHECK-C: store i32 1110027 // CHECK-CPP0X: store i32 1110027 wchar_t we = L'\u1234\U0010F00B'; - -#if __cplusplus >= 201103L - // Should pick second character. - // CHECK-CPP0X: store i16 -4085 - char16_t ue = u'\u1234\U0010F00B'; - - // Should pick second character. - // CHECK-CPP0X: store i32 1110027 - char32_t Ue = U'\u1234\U0010F00B'; -#endif } |