← Back to index
|
Original Bugzilla link
Bug 9465 – Wrong code for delegate call
Status
RESOLVED
Resolution
WORKSFORME
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-06T12:53:00Z
Last change time
2014-07-29T17:20:07Z
Keywords
wrong-code
Assigned to
nobody
Creator
maxim
Comments
Comment #0
by maxim — 2013-02-06T12:53:00Z
import std.stdio; struct S { int i; void bar() { ++i; } void foo() immutable { void delegate() dg1 = &bar; dg1(); // comment out to fix void delegate() dg2; dg2.ptr = cast(void*)&this; dg2.funcptr = cast(void function())&S.bar; dg2(); } } void main() { immutable S s; writeln(s.i); s.foo(); writeln(s.i); } Without dg1() call, dmd arranges registers's content correctly. However in presence of dg1 call it incorrectly rearranges them so that [rex.W callq] calls this pointer, not function pointer.
Comment #1
by yebblies — 2014-07-29T17:20:07Z
This appears to work correctly now.