diff options
author | Jason Merrill <jason@redhat.com> | 2017-05-08 15:08:07 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-05-08 15:08:07 -0400 |
commit | f3ec182d6ca9829004b3b78fca373b8659bf7c01 (patch) | |
tree | d0f58768cb3ec5c1371ac6b542dc445f97d43863 /gcc/cp/call.c | |
parent | 49f0c04c37b2f73dd88ccf5d8fc93c1dcb6ef2c2 (diff) | |
download | gcc-f3ec182d6ca9829004b3b78fca373b8659bf7c01.zip gcc-f3ec182d6ca9829004b3b78fca373b8659bf7c01.tar.gz gcc-f3ec182d6ca9829004b3b78fca373b8659bf7c01.tar.bz2 |
PR c++/80178 - parameter passing for uncopyable classes
* tree.c (type_has_nontrivial_copy_init): True for classes with only
deleted copy/move ctors.
(remember_deleted_copy, maybe_warn_parm_abi): New.
* decl.c (require_complete_types_for_parms, check_function_type):
Call maybe_warn_parm_abi.
* call.c (convert_for_arg_passing, build_cxx_call): Likewise.
From-SVN: r247757
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f1e431c..d9accd1 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7352,17 +7352,21 @@ convert_for_arg_passing (tree type, tree val, tsubst_flags_t complain) && COMPLETE_TYPE_P (type) && tree_int_cst_lt (TYPE_SIZE (type), TYPE_SIZE (integer_type_node))) val = cp_perform_integral_promotions (val, complain); - if ((complain & tf_warning) - && warn_suggest_attribute_format) + if (complain & tf_warning) { - tree rhstype = TREE_TYPE (val); - const enum tree_code coder = TREE_CODE (rhstype); - const enum tree_code codel = TREE_CODE (type); - if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE) - && coder == codel - && check_missing_format_attribute (type, rhstype)) - warning (OPT_Wsuggest_attribute_format, - "argument of function call might be a candidate for a format attribute"); + if (warn_suggest_attribute_format) + { + tree rhstype = TREE_TYPE (val); + const enum tree_code coder = TREE_CODE (rhstype); + const enum tree_code codel = TREE_CODE (type); + if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE) + && coder == codel + && check_missing_format_attribute (type, rhstype)) + warning (OPT_Wsuggest_attribute_format, + "argument of function call might be a candidate " + "for a format attribute"); + } + maybe_warn_parm_abi (type, EXPR_LOC_OR_LOC (val, input_location)); } return val; } @@ -8234,7 +8238,10 @@ build_cxx_call (tree fn, int nargs, tree *argarray, return error_mark_node; if (MAYBE_CLASS_TYPE_P (TREE_TYPE (fn))) - fn = build_cplus_new (TREE_TYPE (fn), fn, complain); + { + fn = build_cplus_new (TREE_TYPE (fn), fn, complain); + maybe_warn_parm_abi (TREE_TYPE (fn), loc); + } } return convert_from_reference (fn); } |