[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 00:17:48 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17461
--- Comment #1 from Manu <turkeyman at gmail.com> ---
For clarity; the high-level flow of the disassembly is:
void t()
{
B __tmpfordtor1804 = u1();
B __tmpfordtor1805 = void; // uninitialised
if (__tmpfordtor1804)
{
__tmpfordtor1805 = u1(); // initialised here
A(__tmpfordtor1805);
}
else
{
A(u2);
}
// __tmpfordtor1805 destructs, may not have been initialised!
__tmpfordtor1805.~this();
// __tmpfordtor1804 destructs, no problem
__tmpfordtor1804.~this();
}
--
More information about the Digitalmars-d-bugs
mailing list