May 28, 2020 [Issue 20869] New: `std.algorithm.mutation : move` is overly trusting of `opPostMove` | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20869 Issue ID: 20869 Summary: `std.algorithm.mutation : move` is overly trusting of `opPostMove` Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Keywords: safe Severity: enhancement Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: pro.mathias.lang@gmail.com ``` import std.algorithm.mutation; struct S { void opPostMove(const ref S old) @system nothrow pure { int* ptr = cast(int*)42; *ptr = 42; } int a; } void main () @safe nothrow { S s1; s1.a = 41; S s2 = move(s1); assert(s2.a == 42); } ``` -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply