Debian Codegraph @

gcc/testsuite/gcc.dg/c23-bool-errors-1.c

raw
1 /* Test error-handling for legacy code that tries to
2 define "bool" with C23. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-std=c23" } */
6
7 typedef int bool; /* { dg-error "'bool' cannot be defined via 'typedef'" } */
8 /* { dg-message "'bool' is a keyword with '-std=c23' onwards" "" { target *-*-* } .-1 } */
9 /* { dg-warning "useless type name in empty declaration" "" { target *-*-* } .-2 } */
10
11 /* Also check that we report the correct standard version for "_Bool". */
12 typedef int _Bool; /* { dg-error "'_Bool' cannot be defined via 'typedef'" } */
13 /* { dg-message "'_Bool' is a keyword with '-std=c99' onwards" "" { target *-*-* } .-1 } */
14 /* { dg-warning "useless type name in empty declaration" "" { target *-*-* } .-2 } */