http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49165
--- Comment #11 from Vijay Rao <gcc at portuosus dot com> 2011-05-27 07:58:25
UTC ---
Does this fix the situation when the 2nd operand of the conditional operator is
of type int?
extern "C" void abort ();
int bar (bool x, int y)
{
if (y < 10 && (x ? 1 : throw 1))
y++;
if (y > 20 || (x ? 1 : throw 2))
y++;
return y;
}
int main ()
{
if (bar (true, 0) != 2
|| bar (true, 10) != 11
|| bar (false, 30) != 31)
abort ();
try
{
bar (false, 0);
abort ();
}
catch (int i)
{
if (i != 1)
abort ();
}
try
{
bar (false, 10);
abort ();
}
catch (int i)
{
if (i != 2)
abort ();
}
}