d_c99_union_cast.c revision 1.8 1 /* $NetBSD: d_c99_union_cast.c,v 1.8 2023/07/07 19:45:22 rillig Exp $ */
2 # 3 "d_c99_union_cast.c"
3
4 /* C99 does not define union cast, it is a GCC extension. */
5
6 /* lint1-flags: -Sw -X 351 */
7
8 struct bar {
9 int a;
10 int b;
11 };
12
13 union foo {
14 struct bar *a;
15 int b;
16 };
17
18 void
19 foo(struct bar *a)
20 {
21 /* expect+1: error: union cast is a GCC extension [328] */
22 a = ((union foo)a).a;
23 /* expect+1: error: union cast is a GCC extension [328] */
24 a = ((union foo)"string");
25 a->a++;
26 }
27