xref: /llvm-project/clang/test/Parser/c2x-func-prototype.c (revision 9c4ade0623af842cda16e5c71b27fb794a3ff3db)
1 // RUN: %clang_cc1 -fsyntax-only -verify=c2x -std=c2x %s
2 // RUN: %clang_cc1 -Wno-strict-prototypes -fsyntax-only -verify -std=c17 %s
3 // expected-no-diagnostics
4 
5 // Functions with an identifier list are not supported in C23.
ident_list(a)6 void ident_list(a) // c2x-error {{expected ';' after top level declarator}} \
7                       c2x-error {{unknown type name 'a'}}
8   int a;
9 {}                 // c2x-error {{expected identifier or '('}}
10 
11 // Functions with an empty parameter list are supported as though the function
12 // was declared with a parameter list of (void). Ensure they still parse.
13 void no_param_decl();
no_param_defn()14 void no_param_defn() {}
15 void (*var_of_type_with_no_param)();
16 typedef void fn();
17