[Bug c++/92467] gcc miscompiles ternary expression with omitted first operand ?: involving C++ prvalues
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 11 21:55:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92467
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Conditionals.html#Conditionals
If I understand the extension correctly, we have:
({
auto &tmp = get1();
(tmp ? tmp: get2()).release();
})
This means the tmp variable goes out of the scope after the ?: statement ends.
More information about the Gcc-bugs
mailing list