This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86184] Conditional expression with omitted operand cannot use rvalue of type convertible to bool
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 21 Jun 2018 16:50:45 +0000
- Subject: [Bug c++/86184] Conditional expression with omitted operand cannot use rvalue of type convertible to bool
- Auto-submitted: auto-generated
- References: <bug-86184-4@http.gcc.gnu.org/bugzilla/>
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 ();
}