https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120778
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org, | |jsm28 at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The defined case in the end just changes from UB to IFNDR, so there isn't too much to test for that one. But 3.2.2 in the paper raises the question whether #if (0, 1) #endif or #if (1 ? 0, 1 : 0) #endif is valid or not. I believe it is invalid in C, where e.g. C23 says in 6.6: "Constant expressions shall not contain assignment, increment, decrement, function-call, or comma operators, except when they are contained within a subexpression that is not evaluated." i.e. while the grammar allows expressions inside of ()s or between ? and : of ?: operator, the above restriction says those can't appear unless skipping evaluation. I don't see something similar in the C++ standard though, including C++98. Sure, assignments, increments, decrements and function calls are not going to work when all the remaining identifiers have been replaced with 0. But comma operator can work just fine. Consider int a[1, 2]; int b[(1, 2)]; int c[1 ? 1, 2 : 3]; int d[0 ? 4 : 5, 6]; in C in all of C89, C99 and C23 all 4 lines are rejected, in C++ (tried 98 to 26) only the first and 4th are rejected and the middle two are accepted.