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 static union {
      6   int a = 42;
      7   char *b;
      8 };
      9 
     10 int f() { return a; }
     11 
     12 // CHECK: define internal void @__cxx_global_var_init
     13 // CHECK-NOT: }
     14 // CHECK: call {{.*}}@"[[CONSTRUCT_GLOBAL:.*]]C1Ev"
     15 
     16 
     17 int g() {
     18   union {
     19     int a;
     20     int b = 81;
     21   };
     22   // CHECK: define {{.*}}_Z1gv
     23   // CHECK-NOT: }
     24   // CHECK: call {{.*}}@"[[CONSTRUCT_LOCAL:.*]]C1Ev"
     25   return b;
     26 }
     27 
     28 
     29 // CHECK: define {{.*}}@"[[CONSTRUCT_LOCAL]]C2Ev"
     30 // CHECK-NOT: }
     31 // CHECK: store i32 81
     32 
     33 // CHECK: define {{.*}}@"[[CONSTRUCT_GLOBAL]]C2Ev"
     34 // CHECK-NOT: }
     35 // CHECK: store i32 42
     36