[Issue 4556] Misbehaving nested function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 1 14:46:52 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4556



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-08-01 14:46:50 PDT ---
See also the 8th example under "Nested Functions" on this page
http://www.digitalmars.com/d/2.0/function.html. Pasted here:

void test()
{   int j;
    static int s;

    struct Foo
    {   int a;

    int bar()
    {   int c = s;        // ok, s is static
        int d = j;        // error, no access to frame of test()

        int foo()
        {
        int e = s;    // ok, s is static
        int f = j;    // error, no access to frame of test()
        return c + a;    // ok, frame of bar() is accessible,
                // so are members of Foo accessible via
                // the 'this' pointer to Foo.bar()
        }

        return 0;
    }
    }
}

This compiles without errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list