[Issue 15315] New: can break immutable with std.algorithm.move
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Nov 10 13:38:56 PST 2015
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 at puremagic.com
Reporter: ag0aep6g at 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);
}
----
--
More information about the Digitalmars-d-bugs
mailing list