llvm-project
15 строк · 918.0 Байт
1// RUN: %clang_cc1 -fsyntax-only -verify=c23 -std=c23 %s -Wpre-c2x-compat
2// RUN: %clang_cc1 -fsyntax-only -verify=c17 -std=c17 %s
3
4constexpr int a = 0; // c17-error {{unknown type name 'constexpr'}} \5c23-warning {{'constexpr' is incompatible with C standards before C23}}
6
7void func(int array[constexpr]); // c23-error {{expected expression}} \8// c17-error {{use of undeclared}}
9
10_Atomic constexpr int b = 0; // c23-error {{constexpr variable cannot have type 'const _Atomic(int)'}} \11// c23-warning {{'constexpr' is incompatible with C standards before C23}} \
12// c17-error {{unknown type name 'constexpr'}}
13
14int static constexpr c = 1; // c17-error {{expected ';' after top level declarator}} \15// c23-warning {{'constexpr' is incompatible with C standards before C23}}
16