summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/static-init.c
blob: b3c8d0f9f1819cd67106dbc53b016f2c58ce765f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// RUN: clang -fsyntax-only -verify %s
static int f = 10;
static int b = f; // expected-error {{initializer element is not a compile-time constant}}

float r  = (float) &r; // FIXME: should give an error: ptr value used where a float was expected
long long s = (long long) &s;
_Bool t = &t;


union bar {
	int i;
};

struct foo {
	unsigned ptr;
};

union bar u[1];
struct foo x = {(long) u}; // no-error
struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}
OpenPOWER on IntegriCloud