www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20176] New: std.container.rbtree does not work at compile time

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

          Issue ID: 20176
           Summary: std.container.rbtree does not work at compile time
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The following code:

    import std.format, std.stdio;

    class X {
        mixin(members());
    }

    string members() {
        import std.container.rbtree;
        auto rbt = redBlackTree(3, 1, 4, 2, 5);
        int x = rbt.front;
        return format("int y = %s;\n", x);
    }

fails to work at compile time with the message "cannot cast ... to ... at
compile time".

--
Aug 27 2019