[clang] [clang][test] Add test for comma operator rejection in preprocessor conditionals (PR #155570)
NohHyeon Kwon via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 22 04:23:25 PDT 2025
swote-git wrote:
@DavidSpickett Thanks for your help.
I can see similar test in `expr_invalid_tok.c`
```c
// PR2284 - The constant-expr production does not including comma.
// CHECK: [[@LINE+1]]:14: error: expected end of line in preprocessor expression
#if 1 ? 2 : 0, 1
#endif
```
What I wanted to write a little more comprehensively was because of the contents of `expr_comma.c`.
```c
// Comma is not allowed in C89
// RUN: not %clang_cc1 -E %s -std=c89 -pedantic-errors
// Comma is allowed if unevaluated in C99
// RUN: %clang_cc1 -E %s -std=c99 -pedantic-errors
// PR2279
#if 0? 1,2:3
#endif
```
https://github.com/llvm/llvm-project/pull/155570
More information about the cfe-commits
mailing list