This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/49165] [4.3/4.4/4.5 Regression] ICE on for-loop/throw combination


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 ();
    }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]