xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/void_arg.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc /* RUN: %clang_cc1 -fsyntax-only %s -verify
2*f4a2713aSLionel Sambuc  */
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc typedef void Void;
5*f4a2713aSLionel Sambuc 
foo()6*f4a2713aSLionel Sambuc void foo() {
7*f4a2713aSLionel Sambuc   int X;
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc   X = sizeof(int (void a));    // expected-error {{argument may not have 'void' type}}
10*f4a2713aSLionel Sambuc   X = sizeof(int (int, void)); // expected-error {{must be the first and only parameter}}
11*f4a2713aSLionel Sambuc   X = sizeof(int (void, ...)); // expected-error {{must be the first and only parameter}}
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc   X = sizeof(int (Void a));    // expected-error {{argument may not have 'void' type}}
14*f4a2713aSLionel Sambuc   X = sizeof(int (int, Void)); // expected-error {{must be the first and only parameter}}
15*f4a2713aSLionel Sambuc   X = sizeof(int (Void, ...)); // expected-error {{must be the first and only parameter}}
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc   // Accept these.
18*f4a2713aSLionel Sambuc   X = sizeof(int (void));
19*f4a2713aSLionel Sambuc   X = sizeof(int (Void));
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc // this is ok.
bar(Void)23*f4a2713aSLionel Sambuc void bar(Void) {
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc void f(const void);            // expected-error {{parameter must not have type qualifiers}}
27