gcc/testsuite/gcc.dg/c23-old-style-definition-6.c
raw| 1 | /* Test old-style function definitions not in C23: () gives a type with |
| 2 | a prototype for all declarations. */ |
| 3 | /* { dg-do compile } */ |
| 4 | /* { dg-options "-std=c23" } */ |
| 5 | |
| 6 | void f1 (); /* { dg-message "declared here" } */ |
| 7 | |
| 8 | /* Prototyped function returning a pointer to a function with no arguments. */ |
| 9 | void (*f2 (void))() { return f1; } |
| 10 | |
| 11 | void |
| 12 | g (void) |
| 13 | { |
| 14 | f1 (1); /* { dg-error "too many arguments" } */ |
| 15 | f2 () (1); /* { dg-error "too many arguments" } */ |
| 16 | } |