[Issue 17461] Bad codegen: compiler emit's call to destructor for uninitialised temporary
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 2 12:52:29 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17461
--- Comment #5 from ag0aep6g at gmail.com ---
(In reply to uplink.coder from comment #3)
> Please check if the bug is still present in 2.075 ~master.
> I cannot reproduce it.
Here's a reduction of the original code, tweaked to make an assert fail:
----
void t()
{
auto a = A(B().p ? B() : B());
}
struct A
{
int p;
}
struct B
{
int p = 42;
alias p this;
~this()
{
import std.conv: text;
assert(p == 42, text(p)); /* fails; prints "1234567890" */
}
}
void main()
{
stomp();
t();
}
void stomp() { int[5] stomper = 1234567890; }
----
Tested with dmd v2.075.0-devel-7326893 on Linux.
--
More information about the Digitalmars-d-bugs
mailing list