Bug 7052 – @system on @safe class methods inconsistency

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-12-02T09:55:00Z
Last change time
2013-10-20T03:12:46Z
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2011-12-02T09:55:41Z
Consider: --- void unsafe() {} @safe class Foo { void bar() @system { unsafe(); } } --- DMD 2.057 Git (887dda0ba) fails with: --- Error: safe function 'bar' cannot call system function 'unsafe' --- The following two examples compile, however (note the different position of @system in the first example): --- void unsafe() {} @safe class Foo { @system void bar() { unsafe(); } } --- --- void unsafe() {} @safe class Foo { void bar() @trusted { unsafe(); } } --- Given that the effects of @safe being applied to classes don't seem to be mentioned in the spec, this is technically not a rejects-valid bug, but certainly very inconsistent.
Comment #1 by verylonglogin.reg — 2013-10-20T03:12:46Z
The case from description compiles now as in case of different attributes the weaker is selected. See Issue 11304.