1 /* Test for constant expressions: __builtin_choose_expr. */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu99 -pedantic-errors" } */
13 /* __builtin_choose_expr acts exactly like the chosen argument for
14 all constant expression purposes. */
16 E1
= __builtin_choose_expr (1, 1, ++b
)
18 /* The first argument to __builtin_choose_expr must be an integer
19 constant expression. */
20 a
= __builtin_choose_expr ((void *)0, b
, c
); /* { dg-error "constant" } */
21 a
= __builtin_choose_expr (0 * (INT_MAX
+ 1), b
, c
); /* { dg-warning "integer overflow in expression" } */
22 /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
23 a
= __builtin_choose_expr (1 / 0, 0, 0); /* { dg-warning "division by zero" } */
24 /* { dg-error "not a constant" "error" { target *-*-* } .-1 } */
25 a
= __builtin_choose_expr ((1 ? 1 : a
), b
, c
); /* { dg-error "constant" } */