[Issue 17080] Can assign member-function-ptr to free-function-ptr
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jan 13 12:54:29 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17080
--- Comment #7 from Dicebot <public at dicebot.lv> ---
(In reply to uplink.coder from comment #6)
> I am going to take care of this.
> I might take a while though.
FYI, this is quick hack I figured out after initial investigation that turns
`addrOf` result into delegate:
diff --git a/src/expression.d b/src/expression.d
index 041ca86ef..0746d51df 100644
--- a/src/expression.d
+++ b/src/expression.d
@@ -10737,6 +10737,11 @@ extern (C++) final class AddrExp : UnaExp
error("'this' reference necessary to take address
of member %s in @safe function %s", f.toChars(), sc.func.toChars());
}
}
+
+ Expression ethis = new NullExp(loc,
f.toAliasFunc().vthis.type);
+ Expression e = new DelegateExp(loc, ethis, f,
ve.hasOverloads);
+ e = e.semantic(sc);
+ return e;
}
}
}
Haven't checked how it affects other code gen though.
--
More information about the Digitalmars-d-bugs
mailing list