[Issue 9465] New: Wrong code for delegate call
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 6 12:53:01 PST 2013
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: nobody at puremagic.com
ReportedBy: maxim at maxim-fomin.ru
--- Comment #0 from Maxim Fomin <maxim at maxim-fomin.ru> 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: -------
More information about the Digitalmars-d-bugs
mailing list