p9.cpp 939 B

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