1 /* { dg-do compile } */
2 /* { dg-options "-Wswitch-enum -Wsign-compare -fstrict-overflow -Wstrict-overflow -Werror -Wno-error=switch-enum" } */
3 /* PR c/66098 - #pragma diagnostic 'ignored' not fully undone by pop for strict-overflow
4 PR c/66711 - GCC does not correctly restore diagnostic state after pragma GCC diagnostic pop with -Werror
6 /* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
9 #pragma GCC diagnostic push
10 #pragma GCC diagnostic ignored "-Wstrict-overflow"
13 #pragma GCC diagnostic pop
18 k
+ 4 < k
; /* { dg-error "overflow" "" { xfail *-*-* } } */
26 /* generates an error - ok */
27 x
+= x
< y
? 1 : 0; /* { dg-error "comparison" } */
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wsign-compare"
31 /* generates no diagnostic - ok */
33 #pragma GCC diagnostic pop
35 x
+= x
< y
? 1 : 0; /* { dg-error "comparison" } */
46 #pragma GCC diagnostic push
47 #pragma GCC diagnostic ignored "-Wswitch-enum"
55 #pragma GCC diagnostic pop
57 switch (e
) /* { dg-warning "switch" } */