aboutsummaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 15:57:41 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 15:57:41 +0330
commit2633a5ec3b1d8423b913e2d1868dfc445897d93d (patch)
tree15ba349f1e8d95512eaa33e8d010ba4176c64fa6 /src/compiler
parentmemdebug: accept 'memdebug scrub;' (the check compared against rt.scrub); the... (diff)
switch: case member(): with no names matches a tagged member by tag even when it has fields (spec 4.7.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 d84f08f..6d1b223 100644
--- a/src/compiler/stmt.zc
+++ b/src/compiler/stmt.zc
@@ -571,7 +571,7 @@ int kw_switch() {
if (!accept(s_comma)) break;
}
expect(s_rp);
- if (nb != pm_nf[gi]) serr("a case binds every field of its member");
+ if (nb && nb != pm_nf[gi]) serr("a case binds every field of its member"); // member() with no names matches by tag (spec 4.7.3)
v = pm_tag[gi];
if (v < 63) cov = cov | (1 << v);
laddr(lslot[tmp]); op(O_LD); op(O_LD); lit(v); op(O_SUB);