Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / static-init.c
blob5333b522bde165419e13a44d1adab4d0acbb24b3
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-pointer-to-int-cast -Wno-bool-conversion %s
3 typedef __typeof((int*) 0 - (int*) 0) intptr_t;
5 static int f = 10;
6 static int b = f; // expected-error {{initializer element is not a compile-time constant}}
8 float r = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}}
9 intptr_t s = (intptr_t) &s;
10 _Bool t = &t;
13 union bar {
14 int i;
17 struct foo {
18 short ptr;
21 union bar u[1];
22 struct foo x = {(intptr_t) u}; // expected-error {{initializer element is not a compile-time constant}}
23 struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}
24 intptr_t z = (intptr_t) u; // no-error