1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -Wno-bool-conversion %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc typedef __typeof((int*) 0 - (int*) 0) intptr_t;
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc static int f = 10;
6f4a2713aSLionel Sambuc static int b = f; // expected-error {{initializer element is not a compile-time constant}}
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc float r  = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}}
9f4a2713aSLionel Sambuc intptr_t s = (intptr_t) &s;
10f4a2713aSLionel Sambuc _Bool t = &t;
11f4a2713aSLionel Sambuc 
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc union bar {
14f4a2713aSLionel Sambuc   int i;
15f4a2713aSLionel Sambuc };
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc struct foo {
18f4a2713aSLionel Sambuc   short ptr;
19f4a2713aSLionel Sambuc };
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc union bar u[1];
22f4a2713aSLionel Sambuc struct foo x = {(intptr_t) u}; // expected-error {{initializer element is not a compile-time constant}}
23f4a2713aSLionel Sambuc struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}
24f4a2713aSLionel Sambuc intptr_t z = (intptr_t) u; // no-error
25