DIP 1021--Argument Ownership and Function Calls--Community Review Round 1

Nick Treleaven nick at geany.org
Fri Aug 30 15:57:40 UTC 2019


On Thursday, 25 July 2019 at 12:03:19 UTC, Nick Treleaven wrote:
> On Friday, 19 July 2019 at 22:36:40 UTC, Olivier FAURE wrote:
>>     byte* identity(ref return byte b) @safe {
>>         return &b;
>>     }
>
> When I saw this (last week), I was surprised it compiled, but 
> it does (with -dip1000). The returned pointer is scope, but 
> that has a different lifetime from ref returns, which only last 
> for the line that called the function.
>
> I don't think `return &b` should compile

https://issues.dlang.org/show_bug.cgi?id=20183





More information about the Digitalmars-d mailing list