1 // RUN: %clang_cc1 %s -emit-llvm -o -
2
3 // This tests all kinds of hard cases with initializers and
4 // array subscripts. This corresponds to PR487.
5
6 struct X { int a[2]; };
7
test()8 int test() {
9 static int i23 = (int) &(((struct X *)0)->a[1]);
10 return i23;
11 }
12
13 int i = (int) &( ((struct X *)0) -> a[1]);
14
15 int Arr[100];
16
foo(int i)17 int foo(int i) { return bar(&Arr[49])+bar(&Arr[i]); }
foo2(int i)18 int foo2(int i) {
19 static const int *X = &Arr[49];
20 static int i23 = (int) &( ((struct X *)0) -> a[0]);
21 int *P = Arr;
22 ++P;
23 return bar(Arr+i);
24 }
25