[Issue 12680] isIterable fails for types with disabled postblit

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 10 12:33:58 PST 2016


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

Lars T. Kyllingstad <bugzilla at kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at kyllingen.net
         Resolution|---                         |INVALID

--- Comment #1 from Lars T. Kyllingstad <bugzilla at kyllingen.net> ---
The example code you posted most definitely should not compile because S is not
iterable.  I guess you forgot the opApply() or range primitives.  The following
code *does* compile successfully:

    import std.traits;

    struct OpApply
    {
        @disable this(this);
        int opApply(int delegate(ref uint) dg) { assert(0); }
    }

    struct Range
    {
        @disable this(this);
        @property uint front() { assert(0); }
        void popFront() { assert(0); }
        enum bool empty = false;
    }

    static assert (isIterable!OpApply);
    static assert (isIterable!Range);

--


More information about the Digitalmars-d-bugs mailing list