Index: clang/lib/Lex/TokenLexer.cpp =================================================================== --- clang/lib/Lex/TokenLexer.cpp +++ clang/lib/Lex/TokenLexer.cpp @@ -501,7 +501,7 @@ assert(VCtx.isInVAOpt() && "should only happen inside a __VA_OPT__"); VCtx.hasPlaceholderAfterHashhashAtStart(); } - if (RParenAfter) + else if (RParenAfter) VCtx.hasPlaceholderBeforeRParen(); } continue; @@ -567,7 +567,7 @@ continue; } - if (RParenAfter) + if (RParenAfter && !NonEmptyPasteBefore) VCtx.hasPlaceholderBeforeRParen(); // If this is on the RHS of a paste operator, we've already copied the Index: clang/test/Preprocessor/macro_vaopt_p1042r1.cpp =================================================================== --- clang/test/Preprocessor/macro_vaopt_p1042r1.cpp +++ clang/test/Preprocessor/macro_vaopt_p1042r1.cpp @@ -28,3 +28,9 @@ #define H5C(X) H5B(X) 5: H5C(H5A()) // CHECK: 5: ab + +namespace GH60268 { +#define H6(X, ...) __VA_OPT__(a ## X) ## b +6: H6(, 1); +// CHECK: 6: ab +}