Mercurial > projects > ldc
view tangotests/nested2.d @ 259:2e652b8ad1fd trunk
[svn r277] Fixed a nasty bug in delegate expressions. Context pointers to nested functions of the parent, from inside a nested function were
invalid.
author | lindquist |
---|---|
date | Fri, 13 Jun 2008 05:47:28 +0200 |
parents | |
children | 88252a1af660 |
line wrap: on
line source
module tangotests.nested2; extern(C) int printf(char*, ...); void main() { int var = 2; void exec(void delegate() dg) { printf("var = %d\n", var); dg(); } void foo() { printf("var = %d\n", var); assert(var == 5); } void bar() { printf("var = %d\n", var); var += 3; exec(&foo); } printf("var = %d\n", var); exec(&bar); return 0; }