https://d.puremagic.com/issues/show_bug.cgi?id=11545
Summary: Aggregate function literal member should not have
access to enclosing scope
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: trivial
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Gabriel Garcia <[email protected]> 2013-11-18 17:55:53
PST ---
import std.stdio;
class hello {
int x = 42;
// should not have access to `this.*`
int function() f = function() {
// accesses `this.x`
return x;
};
}
void g(int function() h) {
writeln(h());
}
void main() {
auto h = new hello();
// outputs 42
writeln(h.f());
// segfaults
g(h.f);
}
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------