boolean_type_node, i_a_r_c);
finish_if_stmt_cond (not_iarc, not_iarc_if);
/* If the initial await resume called value is false, rethrow... */
- tree rethrow = build_throw (fn_start, NULL_TREE);
+ tree rethrow = build_throw (fn_start, NULL_TREE, tf_warning_or_error);
suppress_warning (rethrow);
finish_expr_stmt (rethrow);
finish_then_clause (not_iarc_if);
tree del_coro_fr = coro_get_frame_dtor (coro_fp, orig, frame_size,
promise_type, fn_start);
finish_expr_stmt (del_coro_fr);
- tree rethrow = build_throw (fn_start, NULL_TREE);
+ tree rethrow = build_throw (fn_start, NULL_TREE, tf_warning_or_error);
suppress_warning (rethrow);
finish_expr_stmt (rethrow);
finish_handler (handler);
|| DECL_DESTRUCTOR_P (current_function_decl))
&& !in_nested_catch ())
{
- tree rethrow = build_throw (input_location, NULL_TREE);
+ tree rethrow = build_throw (input_location, NULL_TREE,
+ tf_warning_or_error);
/* Disable all warnings for the generated rethrow statement. */
suppress_warning (rethrow);
finish_expr_stmt (rethrow);
/* Build a throw expression. */
tree
-build_throw (location_t loc, tree exp)
+build_throw (location_t loc, tree exp, tsubst_flags_t complain)
{
if (exp == error_mark_node)
return exp;
return exp;
}
- if (exp && null_node_p (exp))
+ if (exp && null_node_p (exp) && (complain & tf_warning))
warning_at (loc, 0,
"throwing NULL, which has integral, not pointer type");
tree object, ptr;
tree allocate_expr;
- tsubst_flags_t complain = tf_warning_or_error;
-
/* The CLEANUP_TYPE is the internal type of a destructor. */
if (!cleanup_type)
{
if (CLASS_TYPE_P (temp_type))
{
int flags = LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING;
- bool converted = false;
location_t exp_loc = cp_expr_loc_or_loc (exp, loc);
/* Under C++0x [12.8/16 class.copy], a thrown lvalue is sometimes
exp = moved;
/* Call the copy constructor. */
- if (!converted)
- {
- releasing_vec exp_vec (make_tree_vector_single (exp));
- exp = (build_special_member_call
- (object, complete_ctor_identifier, &exp_vec,
- TREE_TYPE (object), flags, tf_warning_or_error));
- }
-
+ releasing_vec exp_vec (make_tree_vector_single (exp));
+ exp = build_special_member_call (object, complete_ctor_identifier,
+ &exp_vec, TREE_TYPE (object), flags,
+ complain);
if (exp == error_mark_node)
{
- inform (exp_loc, " in thrown expression");
+ if (complain & tf_error)
+ inform (exp_loc, " in thrown expression");
return error_mark_node;
}
}
else
{
- tree tmp = decay_conversion (exp, tf_warning_or_error);
+ tree tmp = decay_conversion (exp, complain);
if (tmp == error_mark_node)
return error_mark_node;
exp = cp_build_init_expr (object, tmp);
tree binfo = TYPE_BINFO (TREE_TYPE (object));
tree dtor_fn = lookup_fnfields (binfo,
complete_dtor_identifier, 0,
- tf_warning_or_error);
+ complain);
dtor_fn = BASELINK_FUNCTIONS (dtor_fn);
if (!mark_used (dtor_fn)
|| !perform_or_defer_access_check (binfo, dtor_fn,
cleanup = build_int_cst (cleanup_type, 0);
/* ??? Indicate that this function call throws throw_type. */
- tree tmp = cp_build_function_call_nary (throw_fn, tf_warning_or_error,
+ tree tmp = cp_build_function_call_nary (throw_fn, complain,
ptr, throw_type, cleanup,
NULL_TREE);
/* ??? Indicate that this function call allows exceptions of the type
of the enclosing catch block (if known). */
- exp = cp_build_function_call_vec (rethrow_fn, NULL, tf_warning_or_error);
+ exp = cp_build_function_call_vec (rethrow_fn, NULL, complain);
}
exp = build1_loc (loc, THROW_EXPR, void_type_node, exp);