https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92319
Bug ID: 92319
Summary: Macro expansion using the __VAOPT__ construct is
incorrect when the variadic argument expands to
nothing
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eldlistmailingz at tropicsoft dot com
Target Milestone: ---
When the variadic arguments of a macro whose replacement lists uses the
__VA_OPT__ construct expand to nothing the gcc implementation is incorrect. As
an example from n4835 15.6.1 paragraph 3 shows:
#define F(...) f(0 __VA_OPT__(,) __VA_ARGS__)
#define EMP
F(EMP) should expand to the exact same thing as F(), which is f(0). But in gcc,
while F() expands to f(0), F(EMP) expands to f(0,).
If you need a program which shows this incorrect expansion I can supply one for
you but you should be able to see this for yourself pretty easily.