Confirm: D escapes auto ref similar to Go language

Nick Treleaven nick at geany.org
Mon Aug 25 08:36:05 UTC 2025


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




More information about the Digitalmars-d-learn mailing list