[Issue 24872] New: Assigning non-copyable value to array has no effect

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 22 18:42:38 UTC 2024


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 at puremagic.com
          Reporter: snarwin+bugzilla at 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 at bug.d(13): 123 != 456
---

This shows that the new value of S(456) is not assigned to arr[0].

--


More information about the Digitalmars-d-bugs mailing list