[Issue 8486] Possibly wrong interaction of Variant and const arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 18 12:17:48 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=8486

--- Comment #7 from David Nadlinger <code at klickverbot.at> ---
(In reply to berni44 from comment #6)
> For me the question remains: Is this intentional (for reasons I don't
> understand yet) or a language bug?

Removal of "head const", i.e. the outer layer, is intentional. This avoid
duplicate template instantiations for code that has identical semantics anyway
(like for a const int parameter, where it is copied anyway even if non-const,
so from the caller side, there isn't a difference), and allows range functions
to work in a natural way with constness (where, again, the slice is copied
anyway, so const or not isn't visible to the caller).

--


More information about the Digitalmars-d-bugs mailing list