``` class A {} RedBlackTree!(A, "cast(void*)a < cast(void*)b") tree; ``` This used to work, but now no longer works because of the addition of rbtree.toString. With a nice instantiation error: /Library/D/dmd/src/phobos/std/format.d(2916): Error: template instance std.format.formatObject!(void delegate(const(char)[]), const(A), char) does not match template declaration formatObject(Writer, T, Char)(ref Writer w, ref T val, ref FormatSpec!Char f) if (hasToString!(T, Char)) /Library/D/dmd/src/phobos/std/format.d(2649): Error: template instance std.format.formatValue!(void delegate(const(char)[]), const(A), char) error instantiating /Library/D/dmd/src/phobos/std/format.d(2435): instantiated from here: formatElement!(void delegate(const(char)[]), const(A), char) /Library/D/dmd/src/phobos/std/format.d(3142): instantiated from here: formatRange!(void delegate(const(char)[]), RBRange!(const(RBNode!(A))*), char) /Library/D/dmd/src/phobos/std/container/rbtree.d(1679): instantiated from here: formatValue!(void delegate(const(char)[]), RBRange!(const(RBNode!(A))*), char) /Users/johan/ldc/johan/ddmd/root/array.d(217): instantiated from here: RedBlackTree!(A, "cast(void*)a < cast(void*)b", false)
The commit that added rbtree.toString: https://github.com/dlang/phobos/commit/0f05183f5c792ac3adbc50953a9639b0140a27fc
This is really a problem with Object.toString not working by default for const objects. I will try and make code that optionally adds toString if it can toString each element, this should work once we fix the issue with Object.
PR: https://github.com/dlang/phobos/pull/4353 Note, this will be fixed in stable, since this is a regression.
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/bf1dde7ac7be6751d90ef43c6d303d6530beda6a Fix issue 15941 -- rbtree no longer supports classes https://github.com/dlang/phobos/commit/dbc30e664e6d4c4f53d28e355a715644eab222f8 Merge pull request #4353 from schveiguy/fix15941 Fix issue 15941 -- rbtree no longer supports classes
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/bf1dde7ac7be6751d90ef43c6d303d6530beda6a Fix issue 15941 -- rbtree no longer supports classes https://github.com/dlang/phobos/commit/dbc30e664e6d4c4f53d28e355a715644eab222f8 Merge pull request #4353 from schveiguy/fix15941