Nico Weber | 59705ae | 2010-10-09 00:27:47 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x c++ -triple i386-unknown-unkown -emit-llvm %s -o - | FileCheck %s |
| 2 | // Runs in c++ mode so that wchar_t is available. |
| 3 | |
| 4 | int main() { |
| 5 | // CHECK: store i8 97 |
| 6 | char a = 'a'; |
| 7 | |
| 8 | // Should pick second character. |
| 9 | // CHECK: store i8 98 |
| 10 | char b = 'ab'; |
| 11 | |
| 12 | // CHECK: store i32 97 |
| 13 | wchar_t wa = L'a'; |
| 14 | |
| 15 | // Should pick second character. |
| 16 | // CHECK: store i32 98 |
| 17 | wchar_t wb = L'ab'; |
| 18 | |
| 19 | // Should pick last character and store its lowest byte. |
| 20 | // This does not match gcc, which takes the last character, converts it to |
| 21 | // utf8, and then picks the second-lowest byte of that (they probably store |
| 22 | // the utf8 in uint16_ts internally and take the lower byte of that). |
| 23 | // CHECK: store i8 48 |
| 24 | char c = '\u1120\u0220\U00102030'; |
| 25 | |
| 26 | // CHECK: store i32 61451 |
| 27 | wchar_t wc = L'\uF00B'; |
| 28 | |
| 29 | // CHECK: store i32 1110027 |
| 30 | wchar_t wd = L'\U0010F00B'; |
| 31 | |
| 32 | // Should pick second character. |
| 33 | // CHECK: store i32 1110027 |
| 34 | wchar_t we = L'\u1234\U0010F00B'; |
| 35 | } |