Files
ww/test/wcc/data/callinit_global_reject/case.ww
Hojun-Cho b52f30a894 wcc: reject module-scope alloc/call let initializers at check time
A module-scope let whose rhs runs code (alloc, call — peeled through
cast/?/! wrappers) emitted no DATAW slot: emit_lets' fold-fail
silently skipped the definition and every reference died at LINK
time with 'undefined reference', the one unacceptable failure mode
(rule 7). Hare's model rejects at check time (ref/harec/src/
check.c:4360 'Unable to evaluate initializer at compile time') and
routes runtime init through @init, which ww does not have — so both
frontends now reject at the declaration with identical wording.

alias_infptr_global flips compile->error as the alloc pin (its
letvartnode N_TPTR-over-N_TSTRUCT coverage lives on in the local
alias_infptr_{nest,slicecap} siblings); callinit_global_reject pins
the call shape. Corpus pin 1741/345/21/209/1166/3482.
2026-08-08 19:15:10 +09:00

8 lines
297 B
Plaintext

//ww:error "runtime initializer unsupported (alloc/call; rule 7)"
// The call sibling of alias_infptr_global's alloc reject: a
// module-scope call initializer has no link-time data either.
package main;
fn mk() i64 = { return 7; };
let gc: i64 = mk();
export fn main() i32 = { return gc: i32; };