[clang] [C2y] Support WG14 N3457, the __COUNTER__ macro (PR #162662)
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 15 21:00:59 PDT 2025
hubert-reinterpretcast wrote:
> With respect to the relative positioning for `2` and `3`, we have a situation where all implementations behave one way and the wording implies another.
My earlier reading missed the words "before removal of placemarker tokens, rescanning, and further replacement" in the description of the tokens that a va-opt-replacement is replaced with.
The earlier example reduces to a question of whether the following should produce `"hi"` or `"MACRO"`:
```cpp
#define STR0(X) #X
#define MACRO hi
#define F(...) STR0(__VA_OPT__(MACRO))
static_assert(0, F(_));
```
Producing `"MACRO"` is correct (just as `2 3` is correct in the earlier example).
https://github.com/llvm/llvm-project/pull/162662
More information about the cfe-commits
mailing list