Because, string literals are in Read Only Memory (or should be anyway).
If you write to ROM, it'll of course error by the CPU. So when you duplicated it, it was no longer in ROM, and therefore writable.
Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn Thu, 29 Dec 2022 20:56:31 -0800
Because, string literals are in Read Only Memory (or should be anyway).
If you write to ROM, it'll of course error by the CPU. So when you duplicated it, it was no longer in ROM, and therefore writable.