Thread overview
[Issue 23337] Wrongly elided postblit/copy ctor for array construction (_d_arrayctor lowering)
Sep 15, 2022
kinke
Sep 15, 2022
kinke
Sep 15, 2022
Dlang Bot
Oct 06, 2022
Dlang Bot
September 15, 2022
https://issues.dlang.org/show_bug.cgi?id=23337

--- Comment #1 from kinke <kinke@gmx.net> ---
Another testcase [straight from LDC], not depending on `emplace`:

```
int numPostblit = 0, numDtor = 0;

struct S
{
    int v;
    this(this) { ++numPostblit; }
    ~this() { ++numDtor; }
}

void foo()
{
    S[4] sa = [ S(1), S(2), S(3), S(4) ];

    // helper to generate a slice rvalue
    static S[] toSlice(ref S[4] sa) { return sa[1..$]; }

    S[3] r = toSlice(sa);
}

void main()
{
    foo();
    assert(numPostblit == 3);
    assert(numDtor == 7);
}
```

--
September 15, 2022
https://issues.dlang.org/show_bug.cgi?id=23337

--- Comment #2 from kinke <kinke@gmx.net> ---
[The latter worked from 2.069 to 2.098, then regressed with v2.099.]

--
September 15, 2022
https://issues.dlang.org/show_bug.cgi?id=23337

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@kinke created dlang/dmd pull request #14442 "Fix Issue 23337 - Wrongly elided postblit/copy ctor for array construction (_d_arrayctor lowering)" fixing this issue:

- Fix Issue 23337 - Wrongly elided postblit/copy ctor for array construction
(_d_arrayctor lowering)

https://github.com/dlang/dmd/pull/14442

--
October 06, 2022
https://issues.dlang.org/show_bug.cgi?id=23337

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14442 "Fix Issue 23337 - Wrongly elided postblit/copy ctor for array construction (_d_arrayctor lowering)" was merged into master:

- 6ee695676d5c122125a4b6611e2625c443572d29 by Martin Kinkelin:
  Fix Issue 23337 - Wrongly elided postblit/copy ctor for array construction
(_d_arrayctor lowering)

https://github.com/dlang/dmd/pull/14442

--