2013-08-12 20:51:05 +08:00
|
|
|
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-C %s
|
|
|
|
|
// RUN: %clang_cc1 -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-C %s
|
|
|
|
|
// RUN: %clang_cc1 -x c++ -std=c++11 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-CPP0X %s
|
2011-07-29 09:08:54 +08:00
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2010-10-09 08:27:47 +08:00
|
|
|
|
|
|
|
|
|
int main() {
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-C: store i8 97
|
|
|
|
|
// CHECK-CPP0X: store i8 97
|
2010-10-09 08:27:47 +08:00
|
|
|
|
char a = 'a';
|
|
|
|
|
|
2012-01-18 20:27:10 +08:00
|
|
|
|
// Should truncate value (equal to last character).
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-C: store i8 98
|
|
|
|
|
// CHECK-CPP0X: store i8 98
|
2010-10-09 08:27:47 +08:00
|
|
|
|
char b = 'ab';
|
|
|
|
|
|
2012-01-21 08:16:11 +08:00
|
|
|
|
// Should get concatenated characters
|
2012-01-18 20:27:10 +08:00
|
|
|
|
// CHECK-C: store i32 24930
|
|
|
|
|
// CHECK-CPP0X: store i32 24930
|
|
|
|
|
int b1 = 'ab';
|
|
|
|
|
|
2012-01-21 08:16:11 +08:00
|
|
|
|
// Should get concatenated characters
|
2012-01-18 20:27:10 +08:00
|
|
|
|
// CHECK-C: store i32 808464432
|
|
|
|
|
// CHECK-CPP0X: store i32 808464432
|
|
|
|
|
int b2 = '0000';
|
|
|
|
|
|
2012-01-21 08:16:11 +08:00
|
|
|
|
// Should get truncated value (last four characters concatenated)
|
2012-01-18 20:27:10 +08:00
|
|
|
|
// CHECK-C: store i32 1919512167
|
|
|
|
|
// CHECK-CPP0X: store i32 1919512167
|
|
|
|
|
int b3 = 'somesillylongstring';
|
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-C: store i32 97
|
|
|
|
|
// CHECK-CPP0X: store i32 97
|
2010-10-09 08:27:47 +08:00
|
|
|
|
wchar_t wa = L'a';
|
|
|
|
|
|
|
|
|
|
// Should pick second character.
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-C: store i32 98
|
|
|
|
|
// CHECK-CPP0X: store i32 98
|
2010-10-09 08:27:47 +08:00
|
|
|
|
wchar_t wb = L'ab';
|
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
|
// CHECK-CPP0X: store i16 97
|
2011-07-27 13:40:30 +08:00
|
|
|
|
char16_t ua = u'a';
|
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-CPP0X: store i32 97
|
2011-07-27 13:40:30 +08:00
|
|
|
|
char32_t Ua = U'a';
|
|
|
|
|
|
2012-01-21 08:16:11 +08:00
|
|
|
|
// 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'闗';
|
|
|
|
|
|
|
|
|
|
// 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'💀';
|
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
#endif
|
2011-07-27 13:40:30 +08:00
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-C: store i32 61451
|
|
|
|
|
// CHECK-CPP0X: store i32 61451
|
2010-10-09 08:27:47 +08:00
|
|
|
|
wchar_t wc = L'\uF00B';
|
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
#if __cplusplus >= 201103L
|
2011-07-27 13:40:30 +08:00
|
|
|
|
// -4085 == 0xf00b
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-CPP0X: store i16 -4085
|
2011-07-27 13:40:30 +08:00
|
|
|
|
char16_t uc = u'\uF00B';
|
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-CPP0X: store i32 61451
|
2011-07-27 13:40:30 +08:00
|
|
|
|
char32_t Uc = U'\uF00B';
|
2011-07-29 09:08:54 +08:00
|
|
|
|
#endif
|
2011-07-27 13:40:30 +08:00
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-C: store i32 1110027
|
|
|
|
|
// CHECK-CPP0X: store i32 1110027
|
2010-10-09 08:27:47 +08:00
|
|
|
|
wchar_t wd = L'\U0010F00B';
|
|
|
|
|
|
2011-07-29 09:08:54 +08:00
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
|
// CHECK-CPP0X: store i32 1110027
|
2011-07-27 13:40:30 +08:00
|
|
|
|
char32_t Ud = U'\U0010F00B';
|
2011-07-29 09:08:54 +08:00
|
|
|
|
#endif
|
2011-07-27 13:40:30 +08:00
|
|
|
|
|
2010-10-09 08:27:47 +08:00
|
|
|
|
// Should pick second character.
|
2011-07-29 09:08:54 +08:00
|
|
|
|
// CHECK-C: store i32 1110027
|
|
|
|
|
// CHECK-CPP0X: store i32 1110027
|
2010-10-09 08:27:47 +08:00
|
|
|
|
wchar_t we = L'\u1234\U0010F00B';
|
|
|
|
|
}
|