aboutsummaryrefslogtreecommitdiff
path: root/tests/defer_shadow.ek
diff options
context:
space:
mode:
Diffstat (limited to 'tests/defer_shadow.ek')
-rw-r--r--tests/defer_shadow.ek28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/defer_shadow.ek b/tests/defer_shadow.ek
new file mode 100644
index 0000000..0e890a2
--- /dev/null
+++ b/tests/defer_shadow.ek
@@ -0,0 +1,28 @@
+typedef i9 {}
+typedef i27 {}
+
+define any[] {}
+
+extern _putchar(i9 c);
+
+typedef some_struct[any T] {
+ test()
+ {
+ i9 a = 'a' as i9;
+ {
+ /* at this point, only a is defined */
+ defer _putchar(a);
+
+ /* a gets shadowed */
+ i9 a = 'b' as i9;
+
+ /* defer should still point to the outer 'a' */
+ }
+ }
+}
+
+main()
+{
+ some_struct![i9] test = some_struct![i9]{};
+ test.test();
+}