- tree t = truthvalue_conversion (expr);
- /* If truthvalue_conversion returns a NOP_EXPR, we must fold it here
- to avoid infinite recursion between fold () and convert (). */
- if (TREE_CODE (t) == NOP_EXPR)
- return fold (build1 (NOP_EXPR, type, TREE_OPERAND (t, 0)));
- else
- return fold (build1 (NOP_EXPR, type, t));
+ case VOID_TYPE:
+ return fold_convert_loc (loc, type, e);
+
+ case INTEGER_TYPE:
+ case ENUMERAL_TYPE:
+ ret = convert_to_integer (type, e);
+ goto maybe_fold;
+
+ case BOOLEAN_TYPE:
+ return fold_convert_loc
+ (loc, type, c_objc_common_truthvalue_conversion (input_location, expr));
+
+ case POINTER_TYPE:
+ case REFERENCE_TYPE:
+ ret = convert_to_pointer (type, e);
+ goto maybe_fold;
+
+ case REAL_TYPE:
+ ret = convert_to_real (type, e);
+ goto maybe_fold;
+
+ case FIXED_POINT_TYPE:
+ ret = convert_to_fixed (type, e);
+ goto maybe_fold;
+
+ case COMPLEX_TYPE:
+ ret = convert_to_complex (type, e);
+ goto maybe_fold;
+
+ case VECTOR_TYPE:
+ ret = convert_to_vector (type, e);
+ goto maybe_fold;
+
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ if (lang_hooks.types_compatible_p (type, TREE_TYPE (expr)))
+ return e;
+ break;
+
+ default:
+ break;
+
+ maybe_fold:
+ if (TREE_CODE (ret) != C_MAYBE_CONST_EXPR)
+ ret = fold (ret);
+ return ret;