[Bug c++/24439] [3.4/4.0/4.1 Regression] ICE with invert conditional containing throw
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Oct 19 10:06:00 GMT 2005
------- Comment #4 from rguenth at gcc dot gnu dot org 2005-10-19 10:06 -------
Like so:
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.560
diff -c -3 -p -r1.560 call.c
*** cp/call.c 18 Oct 2005 05:56:04 -0000 1.560
--- cp/call.c 19 Oct 2005 10:02:58 -0000
*************** build_conditional_expr (tree arg1, tree
*** 3226,3231 ****
--- 3226,3233 ----
arg3 = force_rvalue (arg3);
arg3_type = TREE_TYPE (arg3);
result_type = arg3_type;
+ arg2 = build_compound_expr (arg2, build_int_cst (result_type, 0));
+ arg2_type = result_type;
}
else if (TREE_CODE (arg2) != THROW_EXPR
&& TREE_CODE (arg3) == THROW_EXPR)
*************** build_conditional_expr (tree arg1, tree
*** 3234,3239 ****
--- 3236,3243 ----
arg2 = force_rvalue (arg2);
arg2_type = TREE_TYPE (arg2);
result_type = arg2_type;
+ arg3 = build_compound_expr (arg3, build_int_cst (result_type, 0));
+ arg3_type = result_type;
}
else if (VOID_TYPE_P (arg2_type) && VOID_TYPE_P (arg3_type))
result_type = void_type_node;
s/build_int_cst/create_default_constructed_temporary_target_expr/
whatever that will be. At least we don't ICE even for
struct Foo { bool operator!=(int) { return true; } bool operator!() { return
false; }};
void foo(void)
{
int value=1;
!(value?Foo():throw);
}
but we create funny integer constants with type Foo, which is bad.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24439
More information about the Gcc-bugs
mailing list