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.
15 lines
605 B
Plaintext
15 lines
605 B
Plaintext
//ww:error "runtime initializer unsupported (alloc/call; rule 7)"
|
|
// Module-scope alloc initializer: no DATAW slot exists for a
|
|
// runtime-computed global, so pre-reject every reference died at
|
|
// LINK time ("undefined reference to 'main.gp'") — the checker now
|
|
// rejects at the declaration on both frontends (Hare model:
|
|
// ref/harec/src/check.c:4360 rejects non-compile-time-evaluable
|
|
// global initializers; ww has no @init path).
|
|
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;
|
|
};
|