Skip to content

CWG3017 Commas in controlling expression of conditional inclusion #2294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jensmaurer opened this issue Mar 25, 2025 · 0 comments
Open

CWG3017 Commas in controlling expression of conditional inclusion #2294

jensmaurer opened this issue Mar 25, 2025 · 0 comments
Labels
SG22 C / C++ liaison

Comments

@jensmaurer
Copy link
Member

Consider:

  #if 1 ? 1, 0: 3
  #error
  #endif

This seems to be de-jure well-formed, but implementations uniformly reject this (gcc and clang only in pedantic mode) due to a comma operator appearing in the controlling expression of the #if.

The specification status appears to be the same in C++ and C, so SG22 should offer an opinion whether it is actually a correct interpretation of the respective standard that both C and C++ reject this snippet, and if there is some appetite to rectify the specification (as opposed to fixing the bugs in the implementations).

See CWG3017 for details.

@jensmaurer jensmaurer added the SG22 C / C++ liaison label Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SG22 C / C++ liaison
Projects
None yet
Development

No branches or pull requests

1 participant