xref: /llvm-project/clang/test/Parser/c23-constexpr.c (revision aced81c0a5bf30dda99fde2e28364426de4c18d3)
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 
4 constexpr int a = 0; // c17-error {{unknown type name 'constexpr'}} \
5                         c23-warning {{'constexpr' is incompatible with C standards before C23}}
6 
7 void 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 
14 int static constexpr c = 1; // c17-error {{expected ';' after top level declarator}} \
15                             // c23-warning {{'constexpr' is incompatible with C standards before C23}}
16