Bug 7458 – documentation claims non-existent limitation of nested aggregate member functions
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-07T10:57:00Z
Last change time
2012-12-02T10:56:39Z
Keywords
spec
Assigned to
nobody
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2012-02-07T10:57:52Z
d-programming-language.org/function claims:
Member functions of nested classes and structs do not have access to the stack variables of the enclosing function, but do have access to the other symbols:
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;
}
}
}
However, this is wrong. DMD compiles the code fine.
Comment #1 by andrej.mitrovich — 2012-12-02T10:56:39Z
Fixed in another bug entry but can't recall which.