view tangotests/nested2.d @ 283:9bb48fb57a7d trunk

[svn r304] Fix associative array literals by always reserving a zero inited temporary for them.
author ChristianK
date Sat, 21 Jun 2008 00:54:55 +0200
parents 88252a1af660
children
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;
}