https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44317
Kaz Kylheku <kkylheku at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kkylheku at gmail dot com --- Comment #12 from Kaz Kylheku <kkylheku at gmail dot com> --- (In reply to Harald van Dijk from comment #9) > The comma should not be eaten, as the invocation of FAIL() is valid in > standard C++. The rules of concatenation of empty pp-token sequences are > well-defined: the empty sequences are replaced by placemarker preprocessor > tokens, and concatenating any non-placeholder token with a placemarker > preprocessor token produces the former, see [cpp.concat]. And thus, more directly to the point, here is the fix: cpp -std=gnu++0x test.cpp The behavior does not reproduce then; the comma eating works. If you want GNU extensions, request the GNU dialect which most closely corresponds to the ISO dialect you want. The issue here is that ## __VA_ARGS__ is a conforming extension in C, and so it can work even when an ISO dialect is selected. The documentation does not mention that ## __VA_ARGS__ might be valid in some dialects of C++ and so has to be enabled as a nonconforming extension. Also this is an opton. The following workaround also works for me, on gcc 10.x on Debian 11: #define ASSERT( cnd, ... ) SomeClass() __VA_OPT__(,) __VA_ARGS__ #define FAIL( ... ) SomeClass() __VA_OPT__(,) __VA_ARGS__ This works with "cpp" with no options, with "-std=gnu++0x", and with "-std=c++0x". This may be a better workaround for someone who doesn't want to broadly switch to the GNU dialect. __VA_OPT__ didn't exist when this bug was opened.