http://d.puremagic.com/issues/show_bug.cgi?id=9465
Summary: Wrong code for delegate call
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Maxim Fomin <[email protected]> 2013-02-06 12:53:00 PST
---
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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------