[Issue 20670] immutable template specialization pattern matches immutable struct, strips immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 12 15:02:17 UTC 2022


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

--- Comment #6 from FeepingCreature <default_357-line at yahoo.de> ---
Well... it's ... still bad. (As well as spec-violating.) It means that there's
straight up no way in the language to detect any difference between immutable
struct S {} ... S and struct S { } ... immutable S.

The idea is that the constness attached to the type gives a hint as to how that
type should be used. For instance with template functions that return Nullable,
I would expect the first to return Nullable!(immutable S), ie. Nullable!S, and
the second immutable Nullable!S. This is, at the moment, impossible due to this
bug.

--


More information about the Digitalmars-d-bugs mailing list