aboutsummaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 15:56:18 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 15:56:18 +0330
commitf4efb7811b741d006e33838219b7f3857655a71b (patch)
treed555c6056359aab5ed10d00d86c9cacd14bb2942 /src/compiler
parentfndef: allow 24 parameters; the limit check ran after the 24th was counted (diff)
return: a value returned from a void function is dropped and the function yields 0 (typecheck off, spec 4.8.3)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/stmt.zc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/stmt.zc b/src/compiler/stmt.zc
index 21d5801..d84f08f 100644
--- a/src/compiler/stmt.zc
+++ b/src/compiler/stmt.zc
@@ -649,7 +649,7 @@ int kw_return() {
}
if_ret(xty, xzero);
if (fty && fty != tvoid) fcoerce(fty);
- if (fty == tvoid) tcerr("return value", tvoid, xty);
+ if (fty == tvoid) { tcerr("return value", tvoid, xty); op(O_DROP); lit(0); } // typecheck off: the value is ignored (spec 4.8.3)
else if (fty && !compat(fty, xty)) tcerr("return value", fty, xty);
}
if (nclo) {