Skip to content

CWG3017 Commas in controlling expression of conditional inclusion #2294

@jensmaurer

Description

@jensmaurer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SG22C / C++ liaison

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions