constexpr-preop.c 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. static int a[] = {
  2. [+0] = 0, // OK
  3. [+__builtin_choose_expr(0, 0, 0)] = 0, // OK
  4. [+0.] = 0, // KO
  5. [+__builtin_choose_expr(0, 0, 0.)] = 0, // KO
  6. [-0] = 0, // OK
  7. [-__builtin_choose_expr(0, 0, 0)] = 0, // OK
  8. [-0.] = 0, // KO
  9. [-__builtin_choose_expr(0, 0, 0.)] = 0, // KO
  10. [~0] = 0, // OK
  11. [~__builtin_choose_expr(0, 0, 0)] = 0, // OK
  12. [!0] = 0, // OK
  13. [!__builtin_choose_expr(0, 0, 0)] = 0, // OK
  14. [!0.] = 0, // KO
  15. [!__builtin_choose_expr(0, 0, 0.)] = 0, // KO
  16. };
  17. /*
  18. * check-name: constexprness in preops
  19. *
  20. * check-error-start
  21. constexpr-preop.c:4:5: error: bad constant expression
  22. constexpr-preop.c:5:33: error: bad constant expression
  23. constexpr-preop.c:8:4: error: bad constant expression
  24. constexpr-preop.c:9:4: error: bad constant expression
  25. constexpr-preop.c:14:4: error: bad integer constant expression
  26. constexpr-preop.c:15:4: error: bad integer constant expression
  27. constexpr-preop.c:10:4: error: index out of bounds in initializer
  28. constexpr-preop.c:11:4: error: index out of bounds in initializer
  29. * check-error-end
  30. */