this idiom for creating static array used to work, but they are failing now.
What changed and whats the alternative?


T[n] s(T, size_t n)(auto ref T[n] array) pure nothrow @nogc @safe
    return array;

void main() @nogc
int[] myDynamicArray = [1, 2, 3].s; // Slice that static array which is on stack

Deprecation: slice of static array temporary returned by s([1, 2, 3]) assigned to longer lived variable myDynamicArray

Reply via email to