Bug 15941 – [REG v2.069] rbtree no longer supports classes

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-20T15:48:00Z
Last change time
2016-06-18T12:31:48Z
Keywords
pull
Assigned to
schveiguy
Creator
jbc.engelen

Comments

Comment #0 by jbc.engelen — 2016-04-20T15:48:46Z
``` 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)
Comment #1 by bugzilla — 2016-05-24T01:00:36Z
Comment #2 by schveiguy — 2016-05-24T17:54:45Z
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.
Comment #3 by schveiguy — 2016-05-24T20:14:21Z
PR: https://github.com/dlang/phobos/pull/4353 Note, this will be fixed in stable, since this is a regression.
Comment #4 by github-bugzilla — 2016-05-27T16:19:49Z
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
Comment #5 by github-bugzilla — 2016-06-18T12:31:48Z
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