[Issue 12529] New: Function/delegate type alias picks up @safe attribute from surrounding scope
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 6 11:48:33 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12529
Summary: Function/delegate type alias picks up @safe attribute
from surrounding scope
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bugzilla at kyllingen.net
--- Comment #0 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2014-04-06 11:48:27 PDT ---
Consider:
@safe:
alias F = void function();
This wrongly makes F an alias of "void function() @safe" rather than "void
function()".
Here is a test case which should compile, but which fails to do so:
void foo() { }
@safe:
alias F = void function();
@trusted void bar(F f) { f(); }
void main() { bar(&foo); }
DMD says:
bug.d(6): Error: function bug.bar (void function() @safe f) is not callable
using argument types (void function())
--
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