Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s
      2 
      3 // PR10531.
      4 
      5 int make_a();
      6 
      7 static union {
      8   int a = make_a();
      9   char *b;
     10 };
     11 
     12 int f() { return a; }
     13 
     14 // CHECK: define internal void @__cxx_global_var_init
     15 // CHECK-NOT: }
     16 // CHECK: call {{.*}}@"[[CONSTRUCT_GLOBAL:.*]]C1Ev"
     17 
     18 
     19 int 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: }
     37 // CHECK: call {{.*}}@_Z6make_a
     38