Choosing an Approach for the Template Lowering of _d_arrayctor

Paul Backus snarwin at gmail.com
Thu Nov 25 15:10:10 UTC 2021


On Thursday, 25 November 2021 at 14:59:54 UTC, Stanislav Blinov 
wrote:
>
> If you take the first parameter by reference, that shouldn't 
> happen. I.e. in
>
> ```d
> void _d_arrayctor(A,B)(return ref A to, scope B from)
> if (is(A : X[]) && is (B : Y[]) && 
> is(immutable(typeof(A.init[0])) == 
> immutable(typeof(B.init[0])))) { /* ... */ }
> ```
>
> `A` would be a static array, taken by reference.

Unfortunately it is impossible to implement `_d_arrayctor` with 
this signature without invoking undefined behavior. See the 
discussion in this thread for details: 
https://forum.dlang.org/thread/simesvkancmscrtsciwq@forum.dlang.org


More information about the Digitalmars-d mailing list