On 10/31/2019 12:42 PM, Edward Diener wrote:
Given:
#define NO_DATA
#define TRY_VA_OPT(...) __VA_OPT__ (0) 1
TRY_VA_OPT() -> expands to 1 as expected
TRY_VA_OPT(NO_DATA) -> expands to 0 1 which is not expected
when compiled with gcc-9.2 with -std=c++2a.
I have not tested with gcc-8.1 on up at all C++ standard levels, as
__VA_OPT__ is supported there also, but I expect the same results will
occur.
I see no reason why both do not expand to 1. Is this a gcc bug ? If so,
I will report it to gcc. If not can anyone explain the second output ?
The command line parameters i used are:
-fvisibility-inlines-hidden -fPIC -m64 -pthread -O0 -fno-inline -Wall
-Wextra -pedantic -g -fvisibility=hidden -Wno-variadic-macros
-ftrack-macro-expansion=0 -std=c++2a
It is a gcc bug and I have reported it at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92319. Thanks for
everyone's comments !