1 /* Test for constant expressions: C90 aggregate initializers requiring
2 constant expressions. */
3 /* Origin: Joseph Myers <joseph@codesourcery.com> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=iso9899:1990 -pedantic-errors -O2 -fno-trapping-math" } */
12 struct s
{ double d
; };
18 /* As in PR 14649 for static initializers. */
19 struct s a
= { atan (1.0) }; /* { dg-error "is not a constant expression|near initialization" } */
21 struct t b
= { INT_MAX
+ 1 }; /* { dg-warning "integer overflow in expression" } */
22 /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
23 struct t c
= { DBL_MAX
}; /* { dg-warning "overflow in conversion from .double. to .int. changes value " } */
24 /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
25 /* Bad operator outside sizeof. */
26 struct s d
= { 1 ? 1.0 : atan (a
.d
) }; /* { dg-error "is not a constant expression|near initialization" } */