Thread overview
[Issue 21512] RedBlackTree!Tid treats any values as duplicated except for Tid.init
Dec 29, 2020
Tomoya Tanjo
May 02, 2021
Berni44
May 02, 2021
Dlang Bot
May 02, 2021
Dlang Bot
December 29, 2020
https://issues.dlang.org/show_bug.cgi?id=21512

Tomoya Tanjo <ttanjo@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|RedBlackTree!Tid treat any  |RedBlackTree!Tid treats any
                   |values as duplicated except |values as duplicated except
                   |for Tid.init                |for Tid.init

--
May 02, 2021
https://issues.dlang.org/show_bug.cgi?id=21512

Berni44 <bugzilla@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@bernis-buecher.de

--- Comment #1 from Berni44 <bugzilla@bernis-buecher.de> ---
What happens is: to!string calls formatValue in std.format with a const(Tid), but hasToString in std.format fails to detect Tid's toString, because of the constness and thus uses its generic struct handler which always produces the same for all Tids. (Tid.init has a null pointer which is handled special and therefore produces a different result.)


So it boils down to the following should be compilable:

const(Tid) val = void;
val.toString((scope const(char)[] s){});


A workaround is to define lessTid a little bit different:

alias lessTid = (in Tid a, in Tid b) => (cast() a).to!string < (cast()
b).to!string;

--
May 02, 2021
https://issues.dlang.org/show_bug.cgi?id=21512

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@berni44 created dlang/phobos pull request #8028 "Fix Issue 21512 - RedBlackTree!Tid treats any values as duplicated except for Tid.init" fixing this issue:

- Fix Issue 21512 - RedBlackTree!Tid treats any values as duplicated except for Tid.init

https://github.com/dlang/phobos/pull/8028

--
May 02, 2021
https://issues.dlang.org/show_bug.cgi?id=21512

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #8028 "Fix Issue 21512 - RedBlackTree!Tid treats any values as duplicated except for Tid.init" was merged into master:

- 17b3745fe713b30d068145fca78b4eaab69c3e1e by berni44:
  Fix Issue 21512 - RedBlackTree!Tid treats any values as duplicated except for
Tid.init

https://github.com/dlang/phobos/pull/8028

--