April 06, 2014 [Issue 12527] New: Cannot make @system function/delegate alias in a @safe section | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: bugzilla@kyllingen.net --- Comment #0 from Lars T. Kyllingstad <bugzilla@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: ------- |
April 06, 2014 [Issue 12527] Cannot make @system function/delegate alias in a @safe section | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | https://d.puremagic.com/issues/show_bug.cgi?id=12527 --- Comment #1 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2014-04-06 11:55:52 PDT --- Actually, I think the test case should compile even without the explicit @system attribute. I've filed a separate report about this, see issue 12529. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation