diff options
| author | 2026-10-14 15:57:41 +0330 | |
|---|---|---|
| committer | 2026-10-14 15:57:41 +0330 | |
| commit | 2633a5ec3b1d8423b913e2d1868dfc445897d93d (patch) | |
| tree | 15ba349f1e8d95512eaa33e8d010ba4176c64fa6 /tests/conformance | |
| parent | memdebug: 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 'tests/conformance')
| -rw-r--r-- | tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc | 15 | ||||
| -rw-r--r-- | tests/conformance/known.txt | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc b/tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc new file mode 100644 index 0000000..789c650 --- /dev/null +++ b/tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc @@ -0,0 +1,15 @@ +// expect: rect/circle/ +// spec 4.7.3: case member(): with no names matches by tag even when the member has fields +include rt; +enum shape { circle { int r; }, rect { int w; int h; }, dot }; +void t(shape* s) { + switch (s) { case circle(): rt.put_s("circle"); case rect(): rt.put_s("rect"); case dot: rt.put_s("dot"); } + rt.put_c(10); +} +fn main() { + shape* a = shape.rect(4, 5); shape* b = shape.circle(2); + t(a); t(b); + rt.free(a); rt.free(b); + return 0; +} +// zc0: skip diff --git a/tests/conformance/known.txt b/tests/conformance/known.txt index 0540721..fdcb7af 100644 --- a/tests/conformance/known.txt +++ b/tests/conformance/known.txt @@ -1,7 +1,6 @@ # understood conformance failures: PATH IMPL CLASS reason # class a: self-hosted compiler bug; b: zc0 deviation (appendix a/b); c: spec issue to settle 4-statements/o3_outside_function_ordinary_block.zc zy c top-level o3 { } is rejected; spec 4.10.2 says it is an ordinary block -4-statements/switch_tagged_match_by_tag.zc zy a case member(): on a member with fields is rejected (a case binds every field); spec 4.7.3 says it matches by tag 5-declarations/enum_member_names_earlier_b2.zc zy a appendix b.2.2 confirmed: enum members can't name earlier members 5-declarations/fn_prototype_after_definition_b4.zc zy a appendix b.2.4 confirmed: a prototype after the definition hides it 5-declarations/fn_prototype_unnamed_params_b13.zc zy a appendix b.2.13 confirmed (message now: doesn't match its earlier declaration) |
