• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 %s -Eonly -verify -Wno-all -pedantic -std=c++2a
2 
3 //expected-error@+1{{missing '('}}
4 #define V1(...) __VA_OPT__
5 #undef V1
6 // OK
7 #define V1(...) __VA_OPT__  ()
8 #undef V1
9 
10 //expected-warning@+1{{can only appear in the expansion of a variadic macro}}
11 #define V2() __VA_OPT__(x)
12 #undef V2
13 
14 //expected-error@+2{{missing ')' after}}
15 //expected-note@+1{{to match this '('}}
16 #define V3(...) __VA_OPT__(
17 #undef V3
18 
19 #define V4(...) __VA_OPT__(__VA_ARGS__)
20 #undef V4
21 
22 //expected-error@+1{{nested}}
23 #define V5(...) __VA_OPT__(__VA_OPT__())
24 #undef V5
25 
26 //expected-error@+1{{not followed by}}
27 #define V1(...) __VA_OPT__  (#)
28 #undef V1
29 
30 //expected-error@+1{{cannot appear at start}}
31 #define V1(...) __VA_OPT__  (##)
32 #undef V1
33 
34 //expected-error@+1{{cannot appear at start}}
35 #define V1(...) __VA_OPT__  (## X) x
36 #undef V1
37 
38 //expected-error@+1{{cannot appear at end}}
39 #define V1(...) y __VA_OPT__  (X ##)
40 #undef V1
41 
42 
43 #define FOO(x,...) # __VA_OPT__(x) #x #__VA_OPT__(__VA_ARGS__) //OK
44 
45 //expected-error@+1{{not followed by a macro parameter}}
46 #define V1(...) __VA_OPT__(#)
47 #undef V1
48 
49 //expected-error@+1{{cannot appear at start}}
50 #define V1(...) a __VA_OPT__(##) b
51 #undef V1
52 
53 //expected-error@+1{{cannot appear at start}}
54 #define V1(...) a __VA_OPT__(a ## b) b __VA_OPT__(##)
55 #undef V1
56 
57 #define V1(x,...) # __VA_OPT__(b x) // OK
58 #undef V1
59 
60 //expected-error@+2{{missing ')' after}}
61 //expected-note@+1{{to match this '('}}
62 #define V1(...) __VA_OPT__  ((())
63 #undef V1
64 
65