Douglas Gregor | b656d88 | 2009-10-08 22:38:14 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | // floating-point overloads |
| 4 | |
| 5 | __typeof__(0 + 0.0L) ld0; |
| 6 | long double &ldr = ld0; |
| 7 | |
| 8 | __typeof__(0 + 0.0) d0; |
| 9 | double &dr = d0; |
| 10 | |
| 11 | __typeof__(0 + 0.0f) f0; |
| 12 | float &fr = f0; |
| 13 | |
| 14 | // integral promotions |
| 15 | |
| 16 | signed char c0; |
| 17 | __typeof__(c0 + c0) c1; |
| 18 | int &cr = c1; |
| 19 | |
| 20 | unsigned char uc0; |
| 21 | __typeof__(uc0 + uc0) uc1; |
| 22 | int &ucr = uc1; |
| 23 | |
| 24 | short s0; |
| 25 | __typeof__(s0 + s0) s1; |
| 26 | int &sr = s1; |
| 27 | |
| 28 | unsigned short us0; |
| 29 | __typeof__(us0 + us0) us1; |
| 30 | int &usr = us1; |
| 31 | |
| 32 | // integral overloads |
| 33 | |
| 34 | __typeof__(0 + 0UL) ul0; |
| 35 | unsigned long &ulr = ul0; |
| 36 | |
| 37 | template<bool T> struct selector; |
| 38 | template<> struct selector<true> { typedef long type; }; |
| 39 | template<> struct selector<false> {typedef unsigned long type; }; |
| 40 | __typeof__(0U + 0L) ui_l0; |
| 41 | selector<(sizeof(long) > sizeof(unsigned int))>::type &ui_lr = ui_l0; |
| 42 | |
| 43 | __typeof__(0 + 0L) l0; |
| 44 | long &lr = l0; |
| 45 | |
| 46 | __typeof__(0 + 0U) u0; |
| 47 | unsigned &ur = u0; |
| 48 | |
| 49 | __typeof__(0 + 0) i0; |
| 50 | int &ir = i0; |