dip1000 and preview in combine to cause extra safety errors

Walter Bright newshound2 at digitalmars.com
Wed Jun 8 23:19:46 UTC 2022


On 6/8/2022 10:50 AM, John Colvin wrote:
> The problem is `foo` and whether the compiler should somehow prevent the 
> inconsistency between the signature and implementation. Obviously the answer is 
> “yes, ideally”, but in practice with @safe, @system, dip1000, @live and so on 
> it’s all a mess.

The checks aren't done for @system code. Yes, the compiler believes you for 
@system code. It's the point of @system code.

If foo() is annotated with @safe,

   test6.d(5): Deprecation: scope variable `s` may not be returned

The compiler is working as intended, this is not unexpected behavior.


More information about the Digitalmars-d mailing list