From: Gabriel Dos Reis Date: Sun, 22 Feb 2004 17:02:12 +0000 (+0000) Subject: backport: re PR c++/14083 (ICE in conditional expression operator with throw) X-Git-Tag: releases/gcc-3.3.4~242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc89d9e71a157860783776d16f03d49056479d73;p=thirdparty%2Fgcc.git backport: re PR c++/14083 (ICE in conditional expression operator with throw) Backport from mainline 2004-02-13 Mark Mitchell PR c++/14083 * call.c (build_conditional_expr): Call force_rvalue on the non-void operand in the case that one result is a throw-expression and the other is not. From-SVN: r78266 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 86eb2c742cd1..6420993903c4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2004-02-22 Gabriel Dos Reis + + Backport from mainline + 2004-02-13 Mark Mitchell + PR c++/14083 + * call.c (build_conditional_expr): Call force_rvalue on the + non-void operand in the case that one result is a throw-expression + and the other is not. + 2004-02-22 Gabriel Dos Reis Backport from mainline diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 9971c3305d60..a8e4457f15a1 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3243,10 +3243,20 @@ build_conditional_expr (arg1, arg2, arg3) --Both the second and the third operands have type void; the result is of type void and is an rvalue. */ - if ((TREE_CODE (arg2) == THROW_EXPR) - ^ (TREE_CODE (arg3) == THROW_EXPR)) - result_type = ((TREE_CODE (arg2) == THROW_EXPR) - ? arg3_type : arg2_type); + if (TREE_CODE (arg2) == THROW_EXPR + && TREE_CODE (arg3) != THROW_EXPR) + { + arg3 = force_rvalue (arg3); + arg3_type = TREE_TYPE (arg3); + result_type = arg3_type; + } + else if (TREE_CODE (arg2) != THROW_EXPR + && TREE_CODE (arg3) == THROW_EXPR) + { + arg2 = force_rvalue (arg2); + arg2_type = TREE_TYPE (arg2); + result_type = arg2_type; + } else if (VOID_TYPE_P (arg2_type) && VOID_TYPE_P (arg3_type)) result_type = void_type_node; else