aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/4-statements
diff options
context:
space:
mode:
Diffstat (limited to 'tests/conformance/4-statements')
-rw-r--r--tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc15
1 files changed, 15 insertions, 0 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