Files
c3c/test/test_suite/distinct/distinct_union.c3
Christoffer Lerno 5c77c9a754 - Change distinct -> typedef.
- Order of attribute declaration is changed for `alias`.
- Added `LANGUAGE_DEV_VERSION` env constant.
- Rename `anyfault` -> `fault`.
- Changed `fault` -> `faultdef`.
- Added `attrdef` instead of `alias` for attribute aliases.
2025-03-15 20:10:47 +01:00

35 lines
450 B
Plaintext

module test;
union Union
{
int x;
double y;
}
typedef Foo = Union;
union Union2
{
Foo f;
int d;
struct bar
{
Foo x;
}
}
Foo f = { .x = 1 };
typedef Union3 = Union2;
typedef UnionArr = Union3[3];
fn void test(int x)
{
Union s = { .y = 2.0 };
Foo f2 = (Foo)(s);
Foo f3 = { .x = 1 };
Union2 s2 = { .f = { .y = 1 } };
Union2 s3 = { .bar.x.y = 3.0 };
UnionArr a = { [0].bar.x.x = 100 };
}