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

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-15T20:48:41Z
Last change time
2020-03-21T03:56:31Z
Keywords
pull, rejects-valid
Assigned to
Eduard Staniloiu
Creator
Vladimir Panteleev
Depends on
13333

Comments

Comment #0 by dlang-bugzilla — 2014-08-15T20:48:41Z
////////// 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
Comment #1 by dlang-bugzilla — 2014-08-15T20:50:23Z
This regression affects the SDLang library: https://github.com/Abscissa/SDLang-D
Comment #2 by k.hara.pg — 2014-08-19T16:41:00Z
Comment #3 by github-bugzilla — 2014-08-22T19:26:30Z
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'
Comment #4 by trikkuz — 2018-06-15T12:59:41Z
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; }
Comment #5 by b2.temp — 2018-08-25T20:58:33Z
*** Issue 18992 has been marked as a duplicate of this issue. ***
Comment #6 by edi33416 — 2018-12-18T17:25:37Z
Comment #7 by github-bugzilla — 2018-12-24T19:22:02Z
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…