[Issue 4556] Misbehaving nested function

2011-05-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4556


Andrej Mitrovic  changed:

   What|Removed |Added

   Keywords|rejects-valid   |


--- Comment #2 from Andrej Mitrovic  2011-05-19 
22:00:38 PDT ---
This was not a rejects-valid. The compiler doesn't reject, it accepts the two
code snippets.

But I think they're both correct. I've seen code similar to this in TDPL. The
compiler does all the work of creating delegates when needed, right? So the
docs should be updated to reflect that.

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


[Issue 4556] Misbehaving nested function

2010-08-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4556



--- Comment #1 from Andrej Mitrovic  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: ---