D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15941 - [REG v2.069] rbtree no longer supports classes
Summary: [REG v2.069] rbtree no longer supports classes
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: Steven Schveighoffer
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2016-04-20 15:48 UTC by Johan Engelen
Modified: 2016-06-18 12:31 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Johan Engelen 2016-04-20 15:48:46 UTC
```
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 Walter Bright 2016-05-24 01:00:36 UTC
The commit that added rbtree.toString:

https://github.com/dlang/phobos/commit/0f05183f5c792ac3adbc50953a9639b0140a27fc
Comment 2 Steven Schveighoffer 2016-05-24 17:54:45 UTC
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 Steven Schveighoffer 2016-05-24 20:14:21 UTC
PR: https://github.com/dlang/phobos/pull/4353

Note, this will be fixed in stable, since this is a regression.
Comment 4 github-bugzilla 2016-05-27 16:19:49 UTC
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 github-bugzilla 2016-06-18 12:31:48 UTC
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