aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/transparent-union.c
blob: 149c7d947683d81fd267efe135d1d2d6490a44aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
struct a {
	int field;
};
struct b {
	int field;
};

typedef union {
	struct a *a;
	struct b *b;
} transparent_arg __attribute__((__transparent_union__));

static void foo(transparent_arg arg)
{
}

static void bar(void)
{
	struct b arg = { 0 };
	foo((struct a *) &arg);
}

/*
 * check-name: Transparent union attribute.
 */