////////// test.d ////////// import std.array; import std.variant; alias Algebraic!bool Value; struct T { Value value; @disable this(); } void main() { auto a = appender!(T[]); } //////////////////////////// Compiler output: C:\...\std\array.d(2400,34): Error: pure function 'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function 'test.T.__fieldPostBlit' C:\...\std\array.d(2729,1): Error: template instance std.array.Appender!(T[]) error instantiating test.d(14,11): instantiated from here: appender!(T[]) Introduced in https://github.com/D-Programming-Language/phobos/pull/2147
This regression affects the SDLang library: https://github.com/Abscissa/SDLang-D
https://github.com/D-Programming-Language/phobos/pull/2439
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/1baf12b102cc430229d3072433d877f5dc1b0ffb fix Issue 13300 - pure function 'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function 'test.T.__fieldPostBlit' https://github.com/D-Programming-Language/phobos/commit/ef1b0bcf97e12bcc6a2a3202c0f9da6660e0c13e Merge pull request #2439 from 9rnsr/fix13300 [REG2.067a] Issue 13300 - pure function 'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function 'test.T.__fieldPostBlit'
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; }
*** Issue 18992 has been marked as a duplicate of this issue. ***
PR - https://github.com/dlang/phobos/pull/6811
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/c575e985b3dccce3d807165c5b98c8d1862ec366 Fix Issue 13300 - pure function 'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function 'test.T.__fieldPostBlit' https://github.com/dlang/phobos/commit/c7106f02b911c7ca14e3873f5b76cadfb26c5071 Merge pull request #6811 from edi33416/issue_13300 Fix Issue 13300 - pure function 'std.array.Appender!(T[]).Appender.enβ¦