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

Berni44 <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Berni44 <[email protected]> ---
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;

--

Reply via email to