annotate clang/test/Preprocessor/macro_vaopt_p1042r1.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 RUN: %clang_cc1 -E %s -pedantic -std=c++2a | FileCheck -strict-whitespace %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 #define LPAREN() (
anatofuz
parents:
diff changeset
4 #define G(Q) 42
anatofuz
parents:
diff changeset
5 #define F1(R, X, ...) __VA_OPT__(G R X) )
anatofuz
parents:
diff changeset
6 1: int x = F1(LPAREN(), 0, <:-);
anatofuz
parents:
diff changeset
7 // CHECK: 1: int x = 42;
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #define F2(...) f(0 __VA_OPT__(,) __VA_ARGS__)
anatofuz
parents:
diff changeset
10 #define EMP
anatofuz
parents:
diff changeset
11 2: F2(EMP)
anatofuz
parents:
diff changeset
12 // CHECK: 2: f(0 )
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 #define H3(X, ...) #__VA_OPT__(X##X X##X)
anatofuz
parents:
diff changeset
15 3: H3(, 0)
anatofuz
parents:
diff changeset
16 // CHECK: 3: ""
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 #define H4(X, ...) __VA_OPT__(a X ## X) ## b
anatofuz
parents:
diff changeset
19 4: H4(, 1)
anatofuz
parents:
diff changeset
20 // CHECK: 4: a b
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 #define H4B(X, ...) a ## __VA_OPT__(X ## X b)
anatofuz
parents:
diff changeset
23 4B: H4B(, 1)
anatofuz
parents:
diff changeset
24 // CHECK: 4B: a b
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 #define H5A(...) __VA_OPT__()/**/__VA_OPT__()
anatofuz
parents:
diff changeset
27 #define H5B(X) a ## X ## b
anatofuz
parents:
diff changeset
28 #define H5C(X) H5B(X)
anatofuz
parents:
diff changeset
29 5: H5C(H5A())
anatofuz
parents:
diff changeset
30 // CHECK: 5: ab