Using dmd distribution 2.065. This does not compile:
std.container.Array!(immutable(dchar)) array;
Error:
The error seems to be caused because Array.Payload uses destroy on an immutable type and that makes the compiler cry. I see that the code has been updated to support "elaborate destructors", but I don't think it will prevent the problem.
Thx!
Comment #1 by maidenphil — 2014-08-06T19:12:55Z
(In reply to Phil Lavoie from comment #0)
> Using dmd distribution 2.065. This does not compile:
>
> std.container.Array!(immutable(dchar)) array;
>
> Error:
>
> The error seems to be caused because Array.Payload uses destroy on an
> immutable type and that makes the compiler cry. I see that the code has been
> updated to support "elaborate destructors", but I don't think it will
> prevent the problem.
>
> Thx!
If a struct can have an elaborate destructor and be const/immutable at the same time, this seems like it will not compile.
Comment #2 by robert.schadek — 2024-12-01T16:22:07Z