Confirm: D escapes auto ref similar to Go language
Steven Schveighoffer
schveiguy at gmail.com
Mon Aug 25 12:57:01 UTC 2025
On Monday, 25 August 2025 at 08:36:05 UTC, Nick Treleaven wrote:
> On Monday, 25 August 2025 at 00:42:33 UTC, Steven Schveighoffer
> wrote:
>> On Sunday, 24 August 2025 at 20:43:15 UTC, Ali Çehreli wrote:
>>
>>> I think you went a little further in that section and made
>>> the return 'auto ref', which does not (and should not) fail
>>> compilation.
>>
>> No. auto ref is only for templates. This is a bug and should
>> not compile.
>
> An auto ref function does not need to be a template because the
> ref-ness does not depend on how it's called.
>
> https://dlang.org/spec/function.html#auto-ref-functions
Well today I learned this. But it is true for auto ref params.
Still, the op code compiling is a bug as the return value is not
an rvalue.
-Steve
More information about the Digitalmars-d-learn
mailing list