Douglas Gregor | 236d9d16 | 2013-04-16 15:41:08 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -verify -fsyntax-only |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | _Atomic(unsigned int) data1; |
| 5 | int _Atomic data2; |
| 6 | |
| 7 | // Shift operations |
| 8 | |
| 9 | int func_01 (int x) { |
| 10 | return data1 << x; |
| 11 | } |
| 12 | |
| 13 | int func_02 (int x) { |
| 14 | return x << data1; |
| 15 | } |
| 16 | |
| 17 | int func_03 (int x) { |
| 18 | return data2 << x; |
| 19 | } |
| 20 | |
| 21 | int func_04 (int x) { |
| 22 | return x << data2; |
| 23 | } |
| 24 | |
| 25 | int func_05 () { |
| 26 | return data2 << data1; |
| 27 | } |
| 28 | |
| 29 | int func_06 () { |
| 30 | return data1 << data2; |
| 31 | } |
| 32 | |
| 33 | void func_07 (int x) { |
| 34 | data1 <<= x; |
| 35 | } |
| 36 | |
| 37 | void func_08 (int x) { |
| 38 | data2 <<= x; |
| 39 | } |
| 40 | |
| 41 | void func_09 (int* xp) { |
| 42 | *xp <<= data1; |
| 43 | } |
| 44 | |
| 45 | void func_10 (int* xp) { |
| 46 | *xp <<= data2; |
| 47 | } |
Eli Friedman | 09bddcf | 2013-07-08 20:20:06 +0000 | [diff] [blame] | 48 | |
| 49 | int func_11 (int x) { |
| 50 | return data1 == x; |
| 51 | } |
| 52 | |
| 53 | int func_12 () { |
| 54 | return data1 < data2; |
| 55 | } |
| 56 | |
| 57 | int func_13 (int x, unsigned y) { |
| 58 | return x ? data1 : y; |
| 59 | } |
| 60 | |