www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15941] New: Regression: rbtree no longer supports classes

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

          Issue ID: 15941
           Summary: Regression: rbtree no longer supports classes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jbc.engelen gmail.com

```
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)

--
Apr 20 2016