Files
ww/test/wcc/data/alias_infptr_global/case.ww

11 lines
322 B
Plaintext

//ww:run
// A module-scope allocation is evaluated once by the package task before
// main; its pointer remains live in the zero-backed package variable.
package main;
type box = struct { s: str, n: int };
let gp = alloc(box { s = "hi", n = 1 })!;
export fn main() i32 = {
if (gp.s.len != 2) { return 1; };
return 0;
};