www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18992] New: Appender doesn't work with structs that have

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

          Issue ID: 18992
           Summary: Appender doesn't work with structs that have impure
                    postblit
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

test case:

import std.array;

unittest
{
    static void impure(){}

    struct Simple
    {
         disable this(); // Without this, it works.
        this(this) { impure(); }
        this(int tmp) { }
    }

    struct Range
    {
         property Simple front() { return Simple(0); }
        void popFront() {  }
         property empty() { return true; }
        size_t count;
    }

    Range r;
    auto a = r.array();
}

--
Jun 15 2018