[Issue 20032] ImmutableOf!char[] The result is incorrect.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 7 14:02:32 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20032
--- Comment #2 from shove <shove at 163.com> ---
(In reply to ag0aep6g from comment #1)
> (In reply to shove from comment #0)
> > alias A = char[];
> > alias ImmuTypeA = ImmutableOf!A;
> > pragma(msg, ImmuTypeA); // -> immutable(string), Should be:
> > immutable(char[])
>
> immutable(string) and immutable(char[]) are the same type.
>
> string = immutable(char)[]
> immutable(string) = immutable(immutable(char)[]) = immutable(char[])
>
> I'm closing this issue as invalid. Feel free reopen if I'm missing the point.
Thanks. It's not really a bug. I don't need to reopen it.
They are really the same type, Usually no problem. But in some cases, string
comparison through typeid(…) can cause trouble, such as the implementation of
Variant:
https://github.com/dlang/phobos/blob/master/std/variant.d#L299
https://github.com/dlang/phobos/blob/master/std/variant.d#L320
--
More information about the Digitalmars-d-bugs
mailing list