1 /* Test for -Wtraditional warnings on union initialization.
2 Note, gcc should omit these warnings in system header files.
3 By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 9/11/2000. */
4 /* { dg-do compile } */
5 /* { dg-options "-Wtraditional" } */
24 /* Note we only warn for nonzero initializers. */
25 static union foo1 f1
= {0};
26 static union foo2 f2
= {0};
27 static union foo1 f3
= {1}; /* { dg-warning "traditional C rejects initialization of unions" "initialization of unions" } */
28 static union foo2 f4
= {1}; /* { dg-warning "traditional C rejects initialization of unions" "initialization of unions" } */
29 static union foo1 f5
= {0.0};
30 static union foo2 f6
= {0.0};
31 static union foo1 f7
= {1.0}; /* { dg-warning "traditional C rejects initialization of unions" "initialization of unions" } */
32 static union foo2 f8
= {1.0}; /* { dg-warning "traditional C rejects initialization of unions" "initialization of unions" } */
35 /* We are in system headers now, no -Wtraditional warnings should issue. */
37 static union foo1 b1
= {0};
38 static union foo2 b2
= {0};
39 static union foo1 b3
= {1};
40 static union foo2 b4
= {1};
41 static union foo1 b5
= {0.0};
42 static union foo2 b6
= {0.0};
43 static union foo1 b7
= {1.0};
44 static union foo2 b8
= {1.0};