blob: 4db31f0b83fdc1db80df41e895e50f4938a1b068 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s
Richard Smith16ee8192011-09-18 00:06:34 +00002
3// PR10531.
4
Richard Smithd079abf2012-05-07 01:07:30 +00005int make_a();
6
Richard Smith16ee8192011-09-18 00:06:34 +00007static union {
Richard Smithd079abf2012-05-07 01:07:30 +00008 int a = make_a();
Richard Smith16ee8192011-09-18 00:06:34 +00009 char *b;
10};
11
12int f() { return a; }
13
14// CHECK: define internal void @__cxx_global_var_init
15// CHECK-NOT: }
16// CHECK: call {{.*}}@"[[CONSTRUCT_GLOBAL:.*]]C1Ev"
17
18
19int g() {
20 union {
21 int a;
22 int b = 81;
23 };
24 // CHECK: define {{.*}}_Z1gv
25 // CHECK-NOT: }
26 // CHECK: call {{.*}}@"[[CONSTRUCT_LOCAL:.*]]C1Ev"
27 return b;
28}
29
30
31// CHECK: define {{.*}}@"[[CONSTRUCT_LOCAL]]C2Ev"
32// CHECK-NOT: }
33// CHECK: store i32 81
34
35// CHECK: define {{.*}}@"[[CONSTRUCT_GLOBAL]]C2Ev"
36// CHECK-NOT: }
Richard Smithd079abf2012-05-07 01:07:30 +000037// CHECK: call {{.*}}@_Z6make_a