Skip to content

Commit 52bc5db

Browse files
committed
Add #elif test and CWG 3017 context
- Add test coverage for comma operator in #elif directive - Reference CWG 3017 in comments for additional context - Addresses reviewer feedback
1 parent 36f751e commit 52bc5db

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clang/test/Preprocessor/cxx_oper_comma.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#if 1, 2
1111
#endif
1212

13-
// Test 2: Comma in conditional expression
13+
// Test 2: Comma in conditional expression(CWG3017)
14+
// Per CWG 3017, this exact case highlights the specification gap
15+
// where C++ lacks explicit prohibition of comma operators in #if
1416
// expected-error@+1 {{comma operator in operand of #if}}
1517
#if 1 ? 1, 0 : 3
1618
#endif
@@ -24,3 +26,8 @@
2426
// expected-error@+1 {{expected end of line in preprocessor expression}}
2527
#if 1, 2, 3
2628
#endif
29+
30+
// Test 5: Comma in #elif
31+
#if 0
32+
#elif (1, 2) // expected-error {{comma operator in operand of #if}}
33+
#endif

0 commit comments

Comments
 (0)