From 2633a5ec3b1d8423b913e2d1868dfc445897d93d Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 15:57:41 +0330 Subject: switch: case member(): with no names matches a tagged member by tag even when it has fields (spec 4.7.3) --- src/compiler/stmt.zc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3