gcc/testsuite/gcc.dg/c23-unproto-4.c
raw| 1 | /* Test that declaring a function with () is the same as (void) in C23. |
| 2 | Invalid use cases. */ |
| 3 | /* { dg-do compile } */ |
| 4 | /* { dg-options "-std=c23 -pedantic-errors" } */ |
| 5 | |
| 6 | void f1 (); /* { dg-message "previous declaration" } */ |
| 7 | void f1 (int); /* { dg-error "conflicting types" } */ |
| 8 | |
| 9 | void f2 (); /* { dg-message "declared here" } */ |
| 10 | |
| 11 | void |
| 12 | f3 (void) |
| 13 | { |
| 14 | f2 (1); /* { dg-error "too many arguments" } */ |
| 15 | } |