Debian Codegraph @

clang/test/C/C2y/n3344.c

raw
1 // RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s
2 // RUN: %clang_cc1 -verify -Wall -pedantic %s
3
4 /* WG14 N3344: Yes
5 * Slay Some Earthly Demons VI
6 *
7 * A 'void' parameter cannot have any qualifiers, storage class specifiers, or
8 * be followed by an ellipsis.
9 *
10 * Note: Clang treats 'register void' as being a DR and rejects it in all
11 * language modes; there's no evidence that this will break users and it's not
12 * clear what the programmer intended if they wrote such code anyway. This
13 * matches GCC's behavior.
14 */
15
16 void baz(volatile void); // expected-error {{'void' as parameter must not have type qualifiers}}
17 void bar(const void); // expected-error {{'void' as parameter must not have type qualifiers}}
18 void foo(register void); // expected-error {{invalid storage class specifier in function declarator}}
19 void foop(void register); // expected-error {{invalid storage class specifier in function declarator}}
20 void quux(static void); // expected-error {{invalid storage class specifier in function declarator}}
21 void quobble(auto void); // expected-error {{invalid storage class specifier in function declarator}}
22 void quubble(extern void); // expected-error {{invalid storage class specifier in function declarator}}
23 // FIXME: it's odd that these aren't diagnosed as storage class specifiers.
24 #if __STDC_VERSION__ >= 202311L
25 void quibble(constexpr void); // expected-error {{function parameter cannot be constexpr}}
26 #endif
27 #if __STDC_VERSION__ >= 201112L
28 void quabble(_Thread_local void); // expected-error {{'_Thread_local' is only allowed on variable declarations}}
29 #endif
30 void bing(void, ...); // expected-error {{'void' must be the first and only parameter if specified}}
31
32 // These declarations are fine.
33 void one(register void *);
34 void two(void register *);
35 void three(register void * (*)[4]);