[Issue 16652] [Reg 2.071] returned rvalue destroyed too early
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 31 18:11:17 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16652
Martin Nowak <code at 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 at 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
--
More information about the Digitalmars-d-bugs
mailing list