Files
ww/test/wcc/data/r34_append_struct_call_sret/case.ww
Hojun-Cho 50d70e74e4 w6c: append() accepts struct CALL rvalue elements (#34)
Evaluate the call pre-grow into a per-site scratch, receiving by the
N_LET matrix (sret / float / odd-tail / GP), then grow, slot, sized
ladder. Both stages, byte-identical. The two reject pins graduate to
16B GP accept rows; three new fixtures cover 24B GP, 3B/4B tails,
16B float, and 40B sret.
2026-08-08 14:10:55 +09:00

21 lines
626 B
Plaintext

//ww:run-exit 0
// #34 close, sret leg: a >24B struct CALL element writes through the
// hidden RDI into the append scratch before the grow.
package main;
type big40 = struct { a: i64, b: i64, c: i64, d: i64, e: i64 };
fn mkbig(base: i64) big40 = {
let e: big40;
e.a = base; e.b = base + 1i64; e.c = base + 2i64;
e.d = base + 3i64; e.e = base + 4i64;
return e;
};
fn main() i32 = {
let bs: []big40 = [];
append(bs, mkbig(10i64));
append(bs, mkbig(20i64));
if (bs.len != 2) { return 1; };
if (bs[0].a != 10i64 || bs[0].e != 14i64) { return 2; };
if (bs[1].a != 20i64 || bs[1].e != 24i64) { return 3; };
return 0;
};