Understanding DIP 1000 semantics -- Where's the bug?

Sebastiaan Koppe mail at skoppe.eu
Sun Sep 22 15:06:14 UTC 2019


On Sunday, 22 September 2019 at 11:42:44 UTC, Mike Franklin wrote:
> On Sunday, 22 September 2019 at 11:03:29 UTC, Jacob Carlborg 
> wrote:
>
>> In Exhibit B, `i` is a reference and cannot escape the 
>> function `getValue2`.
>
> Actually, ag0aep6g's demonstration at 
> https://forum.dlang.org/post/qm7cib$2n07$1@digitalmars.com 
> proves that statement false.  Unless it is a bug in the 
> compiler that one can convert a `ref` to a pointer in `@safe` 
> code.

Yes. The compiler only looks at the signature when it is checking 
the call site of said function.


More information about the Digitalmars-d mailing list