resulting_type = binary_numeric_promotion (t2, t2,
resulting_type = binary_numeric_promotion (t1, t2,
patch_conditional_expr (node, wfl_cond, wfl_op1)     tree node, wfl_cond, wfl_op1;{  tree cond = TREE_OPERAND (node, 0);  tree op1 = TREE_OPERAND (node, 1);  tree op2 = TREE_OPERAND (node, 2);  tree resulting_type = NULL_TREE;  tree t1, t2, patched;  int error_found = 0;  /* Operands of ?: might be StringBuffers crafted as a result of a     string concatenation. Obtain a descent operand here.  */  if ((patched = patch_string (op1)))    TREE_OPERAND (node, 1) = op1 = patched;  if ((patched = patch_string (op2)))    TREE_OPERAND (node, 2) = op2 = patched;  t1 = TREE_TYPE (op1);  t2 = TREE_TYPE (op2);  /* The first expression must be a boolean */  if (TREE_TYPE (cond) != boolean_type_node)    {      SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);      parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "			   "convert `%s' to `boolean'",			   lang_printable_name (TREE_TYPE (cond), 0));      error_found = 1;    }  /* Second and third can be numeric, boolean (i.e. primitive),     references or null. Anything else results in an error */  if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))	|| ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node) 	    && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))	|| (t1 == boolean_type_node && t2 == boolean_type_node)))    error_found = 1;  /* Determine the type of the conditional expression. Same types are     easy to deal with */  else if (t1 == t2)    resulting_type = t1;  /* There are different rules for numeric types */  else if (JNUMERIC_TYPE_P (t1))    {      /* if byte/short found, the resulting type is short */      if ((t1 == byte_type_node && t2 == short_type_node)	  || (t1 == short_type_node && t2 == byte_type_node))	resulting_type = short_type_node;      /* If t1 is a constant int and t2 is of type byte, short or char	 and t1's value fits in t2, then the resulting type is t2 */      else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))	  && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))	resulting_type = t2;      /* If t2 is a constant int and t1 is of type byte, short or char	 and t2's value fits in t1, then the resulting type is t1 */      else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))	  && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))	resulting_type = t1;      /* Otherwise, binary numeric promotion is applied and the	 resulting type is the promoted type of operand 1 and 2 */      else 	resulting_type = binary_numeric_promotion (t2, t2, 						   &TREE_OPERAND (node, 1), 						   &TREE_OPERAND (node, 2));    }  /* Cases of a reference and a null type */  else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)    resulting_type = t1;  else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)    resulting_type = t2;  /* Last case: different reference types. If a type can be converted     into the other one by assignment conversion, the latter     determines the type of the expression */  else if ((resulting_type = try_reference_assignconv (t1, op2)))    resulting_type = promote_type (t1);  else if ((resulting_type = try_reference_assignconv (t2, op1)))    resulting_type = promote_type (t2);  /* If we don't have any resulting type, we're in trouble */  if (!resulting_type)    {      char *t = strdup (lang_printable_name (t1, 0));      SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);      parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "			   "convert `%s' to `%s'", t,			   lang_printable_name (t2, 0));      free (t);      error_found = 1;    }  if (error_found)    {      TREE_TYPE (node) = error_mark_node;      return error_mark_node;    }  TREE_TYPE (node) = resulting_type;  TREE_SET_CODE (node, COND_EXPR);  CAN_COMPLETE_NORMALLY (node) = 1;  return node;}