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