From bbb6779bed7abcc9fec24ddc513e09bc8f876481 Mon Sep 17 00:00:00 2001 From: lemon Date: Tue, 30 Aug 2022 13:43:10 +0200 Subject: union statics --- test/3.cff | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/3.cff') diff --git a/test/3.cff b/test/3.cff index 7a92c12..7d73db6 100644 --- a/test/3.cff +++ b/test/3.cff @@ -8,6 +8,14 @@ bitfield ColorMaskFlags : u32 { id (8,3), }; +struct Foo { + x int, + y f32, + z union { p *void, i int }, + h enum union { fa, ga *void }, +} +static foo Foo = { .z: { .i: 42 }, .h: :ga(&stderr) }; + fn sum(res int, ...) int { let ap va_list = {}; ap->start(); @@ -26,4 +34,5 @@ extern fn main(argc int, argv **u8) int { printf("= %d\n", sum(1,2,3,42,-1,0)); let rgb = ColorMaskFlags { .red: #t, .blue: #t, .id: 13}; printf("0x%X\n", rgb.#raw); + printf("%d %p\n", foo.z.i, foo.h.ga); } -- cgit v1.2.3