brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 5db803a Raw
46 lines · cpp
1// RUN: %clang_cc1 -E -pedantic-errors %s -verify -std=c++982// RUN: %clang_cc1 -E -pedantic-errors %s -verify -std=c++113// RUN: %clang_cc1 -E -pedantic-errors %s -verify -std=c++144// RUN: %clang_cc1 -E -pedantic-errors %s -verify -std=c++175// RUN: %clang_cc1 -E -pedantic-errors %s -verify -std=c++206// RUN: %clang_cc1 -E -pedantic-errors %s -verify=expected,since-cxx23 -std=c++23 -Wno-c23-extensions7// RUN: %clang_cc1 -E -pedantic-errors %s -verify=expected,since-cxx23 -std=c++2c -Wno-c23-extensions8 9// Test 1: Top-level comma10// expected-error@+1 {{expected end of line in preprocessor expression}}11#if 1, 212#endif13 14// Test 2: Comma in conditional expression(CWG3017)15// Per CWG 3017, this exact case highlights the specification gap16// where C++ lacks explicit prohibition of comma operators in #if17// expected-error@+1 {{comma operator in operand of #if}}18#if 1 ? 1, 0 : 319#endif20 21// Test 3: Parenthesized comma22// expected-error@+1 {{comma operator in operand of #if}}23#if (1, 2)24#endif25 26// Test 4: Multiple commas27// expected-error@+1 {{expected end of line in preprocessor expression}}28#if 1, 2, 329#endif30 31// Test 5: Comma in #elif32#if 033#elif (1, 2) // expected-error {{comma operator in operand of #if}}34#endif35 36// Test 6: Leading comma (syntax error)37// expected-error@+1 {{invalid token at start of a preprocessor expression}}38#if ,39#endif40 41// Test 7: Comma in #embed limit parameter (C++23+)42#if __cplusplus >= 202302L43// since-cxx23-error@+1 {{expected ')'}}44#embed "jk.txt" limit(1, 2)45#endif46