[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / union-init2.c
blobee35e78a4f30100da2977c96eae7a7d2046a1c97
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s
2 // RUN: %clang_cc1 -x c++ %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK-CXX
4 // Make sure we generate something sane instead of a ptrtoint
5 // CHECK: @r, [4 x i8] zeroinitializer
6 union x {long long b;union x* a;} r = {.a = &r};
9 // CHECK: global { [3 x i8], [5 x i8] } zeroinitializer
10 union z {
11 char a[3];
12 long long b;
14 union z y = {};
16 // CHECK: @foo = {{.*}}global %union.Foo undef, align 1
17 // CHECK-CXX: @foo = {{.*}}global %union.Foo undef, align 1
18 union Foo {
19 struct Empty {} val;
21 union Foo foo = {};