blob: 9ab3146ee76e21fa8ccc8f9cfce410ca82196980 [file] [log] [blame]
Daniel Dunbar8d7d6e92009-02-21 23:45:41 +00001// RUN: clang -arch i386 -fsyntax-only -verify %s
Eli Friedman578a9722009-02-22 06:45:27 +00002
3#include <stdint.h>
4
Anders Carlsson1a86b332007-10-17 00:52:43 +00005static int f = 10;
Chris Lattnerd8803632008-08-10 01:58:45 +00006static int b = f; // expected-error {{initializer element is not a compile-time constant}}
Eli Friedmanc1cc6dc2008-05-30 18:14:48 +00007
Eli Friedman578a9722009-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 Friedmanc1cc6dc2008-05-30 18:14:48 +000010_Bool t = &t;
Nuno Lopes83950812009-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 Friedman578a9722009-02-22 06:45:27 +000022struct foo x = {(intptr_t) u}; // no-error
Nuno Lopesff776452009-02-02 22:57:15 +000023struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}