blob: e6592f3bb65301849f2387ae7908b536b0e4563f [file] [log] [blame]
Daniel Dunbarffd408a2009-03-24 02:24:46 +00001// RUN: clang-cc -arch i386 -fsyntax-only -verify %s
Eli Friedman083fb662009-02-22 06:45:27 +00002
3#include <stdint.h>
4
Anders Carlsson855d78d2007-10-17 00:52:43 +00005static int f = 10;
Chris Lattner1543ae92008-08-10 01:58:45 +00006static int b = f; // expected-error {{initializer element is not a compile-time constant}}
Eli Friedman25086f02008-05-30 18:14:48 +00007
Eli Friedman083fb662009-02-22 06:45:27 +00008float r = (float) &r; // expected-error {{initializer element is not a compile-time constant}}
9intptr_t s = (intptr_t) &s;
Eli Friedman25086f02008-05-30 18:14:48 +000010_Bool t = &t;
Nuno Lopes347e0932009-02-02 16:07:41 +000011
12
13union bar {
14 int i;
15};
16
17struct foo {
18 unsigned ptr;
19};
20
21union bar u[1];
Eli Friedman083fb662009-02-22 06:45:27 +000022struct foo x = {(intptr_t) u}; // no-error
Nuno Lopes7dd54222009-02-02 22:57:15 +000023struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}