aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c23-bool-errors-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/c23-bool-errors-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/c23-bool-errors-1.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c23-bool-errors-1.c b/gcc/testsuite/gcc.dg/c23-bool-errors-1.c
new file mode 100644
index 0000000..e3ea98d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c23-bool-errors-1.c
@@ -0,0 +1,14 @@
+/* Test error-handling for legacy code that tries to
+ define "bool" with C23. */
+
+/* { dg-do compile } */
+/* { dg-options "-std=c23" } */
+
+typedef int bool; /* { dg-error "'bool' cannot be defined via 'typedef'" } */
+/* { dg-message "'bool' is a keyword with '-std=c23' onwards" "" { target *-*-* } .-1 } */
+/* { dg-warning "useless type name in empty declaration" "" { target *-*-* } .-2 } */
+
+/* Also check that we report the correct standard version for "_Bool". */
+typedef int _Bool; /* { dg-error "'_Bool' cannot be defined via 'typedef'" } */
+/* { dg-message "'_Bool' is a keyword with '-std=c99' onwards" "" { target *-*-* } .-1 } */
+/* { dg-warning "useless type name in empty declaration" "" { target *-*-* } .-2 } */