blob: b3c8d0f9f1819cd67106dbc53b016f2c58ce765f [file] [log] [blame]
Anders Carlsson1a86b332007-10-17 00:52:43 +00001// RUN: clang -fsyntax-only -verify %s
2static int f = 10;
Chris Lattnerd8803632008-08-10 01:58:45 +00003static int b = f; // expected-error {{initializer element is not a compile-time constant}}
Eli Friedmanc1cc6dc2008-05-30 18:14:48 +00004
Nuno Lopes83950812009-02-02 16:07:41 +00005float r = (float) &r; // FIXME: should give an error: ptr value used where a float was expected
Eli Friedmanc1cc6dc2008-05-30 18:14:48 +00006long long s = (long long) &s;
7_Bool t = &t;
Nuno Lopes83950812009-02-02 16:07:41 +00008
9
10union bar {
11 int i;
12};
13
14struct foo {
15 unsigned ptr;
16};
17
18union bar u[1];
Nuno Lopesff776452009-02-02 22:57:15 +000019struct foo x = {(long) u}; // no-error
20struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}