Thread overview
[Issue 16652] [Reg 2.071] returned rvalue destroyed too early
November 01
https://issues.dlang.org/show_bug.cgi?id=16652

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|returned rvalue gets        |[Reg 2.071] returned rvalue
                   |destroyed before            |destroyed too early
                   |expressions ends            |
           Severity|major                       |regression

--- Comment #1 from Martin Nowak <code@dawg.eu> ---
Turns out this is actually a regression introduced by https://github.com/dlang/dmd/pull/5292.

Also here is the test case with an assertion instead of writeln.

cat > bug.d << CODE
struct Vector
{
    this(ubyte a)
    {
        buf[] = a;
    }

    ubyte[] opSlice()
    {
        return buf[];
    }

    ~this()
    {
        buf[] = 0;
    }

    ubyte[4] buf;
}

void bar(ubyte[] v)
{
    assert(v[0] == 1);
}

void main()
{
    bar(Vector(1)[]);
}
CODE
dmd -inline -run bug

--
November 01
https://issues.dlang.org/show_bug.cgi?id=16652

Ketmar Dark <ketmar@ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar@ketmar.no-ip.org

--
May 19
https://issues.dlang.org/show_bug.cgi?id=16652

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=17399

--