Comment #0 by moonlightsentinel — 2021-12-21T13:18:14Z
CTFE rejects the assignment to `copy[0]` if `arr` is const/immutable even though the static array was copied!
========================================
int countWins(const uint[2] arr)
{
uint[2] copy = arr;
copy[0] = 0;
return 0;
}
enum force = countWins([4, 8]);
========================================
ctfe_copy.d(4): Error: cannot modify read-only constant `[4u, 8u]`
ctfe_copy.d(8): called from here: `countWins([4u, 8u])`
=======================================
Introduced by https://github.com/dlang/dmd/pull/4503.
Comment #1 by razvan.nitu1305 — 2022-01-27T15:28:35Z