Mercurial > projects > ldc
changeset 743:720ec515c300
Add test for accessing foreachval in nested func. Reason for #104.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Fri, 31 Oct 2008 18:17:28 +0100 |
parents | 05e7657a7811 |
children | ef5f75ae6895 |
files | tests/mini/nested20.d |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/mini/nested20.d Fri Oct 31 18:17:28 2008 +0100 @@ -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); + } +}