mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- 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.
35 lines
450 B
Plaintext
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 };
|
|
}
|