Skip to content

Comma expressions rejected in #if for C++23 #132822

Open
@kyuupichan

Description

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

clang -E --std=c++23 --pedantic-errors /tmp/bug.cpp gives:

tmp/bug.cpp:1:10: error: comma operator in operand of #if [-Werror,-Wpedantic]
    1 | #if 1 ? 1, 0: 3
      |         ~^ ~


1 error generated.

I believe that the comma operator has been permitted in constant expressions in C++ since about C++11. If true, this should be accepted.

Metadata

Metadata

Assignees

Labels

c++23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contribute

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions