November 22 [Issue 24872] New: Assigning non-copyable value to array has no effect | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24872 Issue ID: 24872 Summary: Assigning non-copyable value to array has no effect Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody@puremagic.com Reporter: snarwin+bugzilla@gmail.com As of DMD 2.109.1, the following program produces an assertion failure when run: --- struct S { int n; @disable this(this); } void main() { import std.stdio; S[1] arr = [S(123)]; arr = S(456); assert(arr[0].n == 456); // fail } --- The error message is --- core.exception.AssertError@bug.d(13): 123 != 456 --- This shows that the new value of S(456) is not assigned to arr[0]. -- |
Copyright © 1999-2021 by the D Language Foundation