enum-bounds.c 502 B

1234567891011121314151617181920212223242526
  1. enum bound_int_max {
  2. IMAX = __INT_MAX__,
  3. };
  4. _Static_assert([typeof(IMAX)] == [int], "");
  5. enum bound_int_maxp1 {
  6. IMP1 = __INT_MAX__ + 1L,
  7. };
  8. _Static_assert([typeof(IMP1)] == [unsigned int], "");
  9. enum bound_int_maxm1 {
  10. IMM1 = -__INT_MAX__ - 1L,
  11. };
  12. _Static_assert([typeof(IMM1)] == [int], "");
  13. enum bound_int_maxm2 {
  14. IMM2 = -__INT_MAX__ - 2L,
  15. };
  16. _Static_assert([typeof(IMM2)] == [long], "");
  17. /*
  18. * check-name: enum-bounds
  19. * check-command: sparse -m64 $file
  20. * check-assert: sizeof(long) == 8
  21. */