xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/union-init2.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // Make sure we generate something sane instead of a ptrtoint
4*f4a2713aSLionel Sambuc // CHECK: bitcast ({ %union.x*, [4 x i8] }* @r to %union.x*), [4 x i8] undef
5*f4a2713aSLionel Sambuc union x {long long b;union x* a;} r = {.a = &r};
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc // CHECK: global { [3 x i8], [5 x i8] } { [3 x i8] zeroinitializer, [5 x i8] undef }
9*f4a2713aSLionel Sambuc union z {
10*f4a2713aSLionel Sambuc   char a[3];
11*f4a2713aSLionel Sambuc   long long b;
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc union z y = {};
14