[Issue 9685] New: Context pointer of struct isn't copied when a closure is passed by alias
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 10 22:43:50 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9685
Summary: Context pointer of struct isn't copied when a closure
is passed by alias
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: deadalnix at gmail.com
--- Comment #0 from deadalnix <deadalnix at gmail.com> 2013-03-10 22:43:49 PDT ---
module structfail;
auto get(alias fun)() {
struct Foo {
size_t data;
@property
auto clone() {
return Foo(data);
}
}
return Foo(0);
}
void main() {
uint a = 42;
auto bar = get!(() => a)();
auto qux = bar.clone;
import std.stdio;
writeln("bar context pointer :", (cast(void**) &bar)[1]);
writeln("qux context pointer :", (cast(void**) &qux)[1]);
}
qux have a garbage context pointer.
--
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