[Issue 12527] New: Cannot make @system function/delegate alias in a @safe section
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 6 07:25:11 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12527
Summary: Cannot make @system function/delegate alias in a @safe
section
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 07:25:09 PDT ---
Consider the following:
@safe:
alias Fun = void function() @system;
pragma (msg, Fun.stringof);
alias Del = void delegate() @system;
pragma (msg, Del.stringof);
When compiling this, DMD prints:
void function() @safe
void delegate() @safe
In other words, the @safe: directive somehow prevents the @system attribute
from becoming part of the alias. Here is a test case which should compile, but
which doesn't:
@safe:
alias Fun = void function() @system;
@system void foo() { }
@trusted void bar(Fun fun) { fun(); }
void main() { bar(&foo); }
This fails with the following error message:
bug.d(5): Error: function bug.bar (void function() @safe fun) is not callable
using argument types (void function() @system)
--
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