From 9fcc2d85a22a68b04d5445512571ad40c87968cc Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 31 Oct 2008 18:17:28 +0100 Subject: [PATCH] Add test for accessing foreachval in nested func. Reason for #104. --- tests/mini/nested20.d | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/mini/nested20.d diff --git a/tests/mini/nested20.d b/tests/mini/nested20.d new file mode 100644 index 00000000..39e6f99f --- /dev/null +++ b/tests/mini/nested20.d @@ -0,0 +1,17 @@ +extern(C) int printf(char*, ...); + +void main() +{ + int[] arr = [1]; + foreach(s; arr) + { + void foo() + { + printf("n %d\n", s); + } + + printf("o1 %d\n", s); + foo(); + printf("o2 %d\n", s); + } +}