[Issue 12338] New: @trusted delegates should implicitly cast to @safe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 10 11:11:08 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12338
Summary: @trusted delegates should implicitly cast to @safe
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: destructionator at gmail.com
--- Comment #0 from Adam D. Ruppe <destructionator at gmail.com> 2014-03-10 11:11:07 PDT ---
@safe void test(void delegate() @safe dg) {
dg();
}
@trusted void bug() { }
void main() @safe {
test(&bug);
}
safety.d(8): Error: function safety.test (void delegate() @safe dg) is not
callable using argument types (void function() @trusted)
I think that should work since @trusted functions can normally be called by
@safe functions, so the delegate should implicitly cast too.
Note that if you change the call line to this:
test({ bug(); });
It will compile - the anonymous delegate is inferred as @safe.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list