July 07, 2019 [Issue 20032] ImmutableOf!char[] The result is incorrect. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20032 ag0aep6g <ag0aep6g@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |ag0aep6g@gmail.com Resolution|--- |INVALID --- Comment #1 from ag0aep6g <ag0aep6g@gmail.com> --- (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. -- |
July 07, 2019 [Issue 20032] ImmutableOf!char[] The result is incorrect. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20032 --- Comment #2 from shove <shove@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 -- |
Copyright © 1999-2021 by the D Language Foundation