diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/c23-unproto-4.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/c23-unproto-4.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c23-unproto-4.c b/gcc/testsuite/gcc.dg/c23-unproto-4.c new file mode 100644 index 0000000..7321753 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c23-unproto-4.c @@ -0,0 +1,15 @@ +/* Test that declaring a function with () is the same as (void) in C23. + Invalid use cases. */ +/* { dg-do compile } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ + +void f1 (); /* { dg-message "previous declaration" } */ +void f1 (int); /* { dg-error "conflicting types" } */ + +void f2 (); /* { dg-message "declared here" } */ + +void +f3 (void) +{ + f2 (1); /* { dg-error "too many arguments" } */ +} |