digitalmars.D.bugs - [Issue 15315] New: can break immutable with std.algorithm.move
- via Digitalmars-d-bugs (33/33) Nov 10 2015 https://issues.dlang.org/show_bug.cgi?id=15315
https://issues.dlang.org/show_bug.cgi?id=15315 Issue ID: 15315 Summary: can break immutable with std.algorithm.move Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: ag0aep6g gmail.com Shown by Mike Parker in D.learn: http://forum.dlang.org/post/dqjesecgvpislphpoiaj forum.dlang.org ---- static struct ku { immutable int id; ~this() safe {} } void main() safe { ku k1 = ku(1); scope(exit) assert(k1.id == 1); /* fails */ ku k2 = ku(2); scope(exit) assert(k2.id == 2); /* fails too, because there's a destructor */ import std.algorithm: move; move(k2, k1); } ---- --
Nov 10 2015