File: n3344.c

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (35 lines) | stat: -rw-r--r-- 1,884 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s
// RUN: %clang_cc1 -verify -Wall -pedantic %s

/* WG14 N3344: Yes
 * Slay Some Earthly Demons VI
 *
 * A 'void' parameter cannot have any qualifiers, storage class specifiers, or
 * be followed by an ellipsis.
 *
 * Note: Clang treats 'register void' as being a DR and rejects it in all
 * language modes; there's no evidence that this will break users and it's not
 * clear what the programmer intended if they wrote such code anyway. This
 * matches GCC's behavior.
 */

void baz(volatile void);         // expected-error {{'void' as parameter must not have type qualifiers}}
void bar(const void);            // expected-error {{'void' as parameter must not have type qualifiers}}
void foo(register void);         // expected-error {{invalid storage class specifier in function declarator}}
void foop(void register);        // expected-error {{invalid storage class specifier in function declarator}}
void quux(static void);          // expected-error {{invalid storage class specifier in function declarator}}
void quobble(auto void);         // expected-error {{invalid storage class specifier in function declarator}}
void quubble(extern void);       // expected-error {{invalid storage class specifier in function declarator}}
// FIXME: it's odd that these aren't diagnosed as storage class specifiers.
#if __STDC_VERSION__ >= 202311L
void quibble(constexpr void);    // expected-error {{function parameter cannot be constexpr}}
#endif
#if __STDC_VERSION__ >= 201112L
void quabble(_Thread_local void); // expected-error {{'_Thread_local' is only allowed on variable declarations}}
#endif
void bing(void, ...);            // expected-error {{'void' must be the first and only parameter if specified}}

// These declarations are fine.
void one(register void *);
void two(void register *);
void three(register void * (*)[4]);