Bug 11304 – In case of different @safe/@trusted/@system attributes the weaker is selected

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-20T01:40:00Z
Last change time
2015-07-16T10:25:07Z
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2013-10-20T01:40:53Z
In case of different attributes the weaker is selected i.e. `f1` is expected to be @safe: --- void f() @system {} @trusted { void f1() @safe { static assert(!__traits(compiles, f())); } // assert fails } @safe { void f2() @trusted { f(); } // @trusted as expected } // It would be also good to reject g1/g2: @safe void g1() @trusted { f(); } // compiled as @trusted @trusted void g2() @safe { f(); } // compiled as @trusted ---
Comment #1 by k.hara.pg — 2015-07-16T10:25:07Z
(In reply to Denis Shelomovskij from comment #0) > void f() @system {} > > @trusted { > void f1() @safe > { static assert(!__traits(compiles, f())); } // assert fails > } From 2.066, f1 is marked as @safe, then the assert failure is fixed. > // It would be also good to reject g1/g2: > @safe void g1() @trusted { f(); } // compiled as @trusted > @trusted void g2() @safe { f(); } // compiled as @trusted From 2.066, those fails to compile with "conflicting storage class" error.