[Bug preprocessor/125655] New: Invalid __VA_ARGS__ or __VA_OPT__ in #elif is accepted
luigighiron at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jun 8 04:20:37 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125655
Bug ID: 125655
Summary: Invalid __VA_ARGS__ or __VA_OPT__ in #elif is accepted
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: luigighiron at gmail dot com
Target Milestone: ---
GCC incorrectly accepts the following:
#if 0
#elif __VA_ARGS__
#endif
The same applies to __VA_OPT__. It is rejected in #if, so it should be rejected
in #elif too if it was not skipped. Clang rejects it even in skipped #elif
directives (replace 0 with 1 in the above), though I think that should not be
done.
More information about the Gcc-bugs
mailing list