================ @@ -15,3 +16,25 @@ c:FOO3() #define FOO4(X, Y) X ## Y d:FOO4(,FOO4(,)) // CHECK: d:FOO4 + +// Consecutive ## operators need not make an expansion invalid: the +// placemarkers from the empty arguments allow this to expand to nothing. +#define PASTE1(X) X ## X X ## ## X X ## X +before PASTE1() after +// CHECK: before after + +// The leading placemarker also supplies an operand when the final token is +// nonempty. +#define PASTE_LEADING(X) X ## X X ## ## 2 +e:PASTE_LEADING() +// CHECK: e:2 + +// Each leading placemarker can supply an operand for a surviving operator. +#define PASTE_TWO_LEADING(X) X X X ## ## ## 2 ---------------- daniel-petrovic wrote:
Note that according https://eel.is/c++draft/cpp.concat#3 the evaluation order of ## operator is unspecified. GCC Currently rejects this because of invalid ##2 token, which may be legitimate decision too. https://github.com/llvm/llvm-project/pull/239693 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
