[Issue 13300] pure function 'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function 'test.T.__fieldPostBlit'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 15 12:59:41 UTC 2018


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

Andrea Fontana <trikkuz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |trikkuz at gmail.com
         Resolution|FIXED                       |---

--- Comment #4 from Andrea Fontana <trikkuz at gmail.com> ---
Same problem, for structs with impure postblit.
I think those functions should be templatized. Or maybe we can remove pure at
all and add a unittest to force test against pure structs.

------

import std.experimental.all;

int i;

void main()
{
    Range r;
    r.array().writeln;
}

struct Simple
{
    @disable this(); // Without this, it works.
    this(this) { i++; }

    private:
    this(int tmp) { }
}

struct Range
{
    @property Simple front() { return S(0); }
    void popFront() { count++; }
    @property empty() { return count < 3; }
    size_t count;
}

--


More information about the Digitalmars-d-bugs mailing list