MSVC doesn’t expand __VA_ARGS__ correctly

Edit:
This issue might be resolved by using
/Zc:preprocessor or /experimental:preprocessor option in recent MSVC.
For the details, please see
here.

MSVC’s preprocessor seems to behave quite differently from the standard
specification.
Probably the following workaround will help:

#define EXPAND( x ) x
#define F(x, ...) X = x and VA_ARGS = __VA_ARGS__
#define G(...) EXPAND( F(__VA_ARGS__) )

Leave a Comment