Subject: Interpretation of __VA_OPT__
From: Edward Diener (eldlistmailingz_at_[hidden])
Date: 2019-10-31 16:27:15
#define TRY_VA_OPT(...)Â __VA_OPT__ (0) 1
granted that TRY_VA_OPT()Â expands to 1, what does TRY_VA_OPT(NO_DATA)
expand to ?
I would have thought that it also expands to 1 but gcc-9.2 in C++20 mode
expands it to 0 1 while clang-9.0 in C++20 expands it to 1. In trying to
interpret 15.6.1 paragraph 3 of n4835 it seems to me that the
determination of whether or not the __VA_OPT__ construct expands to a
single placemarker token or its pp-tokens should be made based on the
variadic parameter argument(s) after they are fully macro replaced,
since all occurrences of __VA_ARGS__ in the replacement list occur after
the variadic parameter argument(s) are fully macro replaced, just like
any other parameter in the replacement list.
What is the correct interpretation of how this should work ?
STD-DISCUSSION list run by herb.sutter at gmail.com
Older Archives on Google Groups