Bug 13809 – dup no longer works with types with postblit and destructors

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-02T13:25:00Z
Last change time
2015-02-18T03:38:30Z
Assigned to
nobody
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2014-12-02T13:25:03Z
///// test.d //// struct S { this(this) {} ~this() {} } void main() { S[] arr; arr.dup; } ///////////////// C:\...\object.di(753): Error: pure function 'object._getPostblit!(S)._getPostblit' cannot call impure function 'test.S.~this' C:\...\object.di(772): Error: template instance object._getPostblit!(S) error instantiating C:\...\object.di(729): instantiated from here: _doPostblit!(S) C:\...\object.di(683): instantiated from here: _dup!(const(S), S) test.d(10): instantiated from here: dup!(S) Introduced in https://github.com/D-Programming-Language/druntime/pull/1031
Comment #1 by github-bugzilla — 2014-12-03T03:36:06Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/949e7348f14a322c6b7de05d3a249086a51f0995 fix Issue 13809 - dup no longer works with types with postblit and destructors - nested function literal is also assumed to be pure therefor the compiler complains about an impure destructor - move the typeof to a separate _PostBlitType template as we only use it to get the postblit attributes https://github.com/D-Programming-Language/druntime/commit/b66f2db7efabbaaf7473d4d51ded242db7ce388b Merge pull request #1054 from MartinNowak/fix13809 fix Issue 13809 - dup no longer works with types with postblit and destructors
Comment #2 by github-bugzilla — 2014-12-03T06:53:50Z
Comment #3 by github-bugzilla — 2015-02-18T03:38:30Z