[Bug c++/86184] Conditional expression with omitted operand cannot use rvalue of type convertible to bool
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 21 16:50:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86184
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Runtime test:
int j;
struct X {
X() { j++; }
operator bool() { return true; }
};
/* Only create X once. */
bool b = X() ?: false;
bool b2 = X() ? X() : false;
int
main ()
{
if (j != 3)
__builtin_abort ();
}
More information about the Gcc-bugs
mailing list