xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/2007-05-29-UnionCopy.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - %s | grep memcpy
2*f4a2713aSLionel Sambuc // PR1421
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc struct A {
5*f4a2713aSLionel Sambuc   char c;
6*f4a2713aSLionel Sambuc   int i;
7*f4a2713aSLionel Sambuc };
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc struct B {
10*f4a2713aSLionel Sambuc   int c;
11*f4a2713aSLionel Sambuc   unsigned char x;
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc union U { struct A a; struct B b; };
15*f4a2713aSLionel Sambuc 
check(union U * u,union U * v)16*f4a2713aSLionel Sambuc void check(union U *u, union U *v) {
17*f4a2713aSLionel Sambuc   *u = *v;
18*f4a2713aSLionel Sambuc }
19