diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-10-27 22:33:40 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-10-27 17:33:40 -0500 |
commit | e6e174e5609155eca637b5b14a3dd5cc407a415a (patch) | |
tree | e789a16e8f98d4349de8a3dcb9b0a52db49e1f6b /gcc/cp/call.c | |
parent | 950ad3c380028795a85da9e841dc9cc52a06118a (diff) | |
download | gcc-e6e174e5609155eca637b5b14a3dd5cc407a415a.zip gcc-e6e174e5609155eca637b5b14a3dd5cc407a415a.tar.gz gcc-e6e174e5609155eca637b5b14a3dd5cc407a415a.tar.bz2 |
call.c (standard_conversion): instantiate_type here.
* call.c (standard_conversion): instantiate_type here.
(reference_binding): And here.
(implicit_conversion): Not here.
(build_op_delete_call): No need to cons up an OVERLOAD.
* cvt.c (cp_convert_to_pointer): instantiate_type here.
(convert_to_reference): And here.
* decl.c (grok_reference_init): Not here.
(grokparms): Or here.
* typeck2.c (digest_init): Or here.
* typeck.c (decay_conversion): Take the address of overloaded
functions, too.
(require_instantiated_type): Lose.
(convert_arguments): Don't handle unknown types here.
(build_c_cast): Likewise.
(build_binary_op): Gut.
(build_conditional_expr): Don't require_instantiated_type.
(build_modify_expr): Likewise.
(build_static_cast): Don't instantiate_type.
(build_reinterpret_cast): Likewise.
(build_const_cast): Likewise.
(convert_for_initialization): Likewise.
(build_ptrmemfunc): Use type_unknown_p.
(convert_for_assignment): Also do default_conversion on overloaded
functions. Hand them off to ocp_convert.
* pt.c (convert_nontype_argument): Tell instantiate_type to complain.
Do complain about overload resolution producing a non-public fn.
From-SVN: r23373
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 94f6298..8e074b6 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -803,6 +803,15 @@ standard_conversion (to, from, expr) to = strip_top_quals (to); from = strip_top_quals (from); + if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to)) + && expr && type_unknown_p (expr)) + { + expr = instantiate_type (to, expr, 0); + if (expr == error_mark_node) + return NULL_TREE; + from = TREE_TYPE (expr); + } + fcode = TREE_CODE (from); tcode = TREE_CODE (to); @@ -968,6 +977,14 @@ reference_binding (rto, rfrom, expr, flags) tree from = rfrom; int related; + if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr)) + { + expr = instantiate_type (to, expr, 0); + if (expr == error_mark_node) + return NULL_TREE; + from = TREE_TYPE (expr); + } + if (TREE_CODE (from) == REFERENCE_TYPE) from = TREE_TYPE (from); else if (! expr || ! real_lvalue_p (expr)) @@ -1032,14 +1049,6 @@ implicit_conversion (to, from, expr, flags) tree conv; struct z_candidate *cand; - if (expr && type_unknown_p (expr)) - { - expr = instantiate_type (to, expr, 0); - if (expr == error_mark_node) - return 0; - from = TREE_TYPE (expr); - } - if (TREE_CODE (to) == REFERENCE_TYPE) conv = reference_binding (to, from, expr, flags); else @@ -1049,7 +1058,7 @@ implicit_conversion (to, from, expr, flags) ; else if (expr != NULL_TREE && (IS_AGGR_TYPE (non_reference (from)) - || IS_AGGR_TYPE (non_reference (to))) + || IS_AGGR_TYPE (non_reference (to))) && (flags & LOOKUP_NO_CONVERSION) == 0) { cand = build_user_type_conversion_1 @@ -2907,11 +2916,6 @@ build_op_delete_call (code, addr, size, flags, placement) if (type != TYPE_MAIN_VARIANT (type)) addr = cp_convert (build_pointer_type (TYPE_MAIN_VARIANT (type)), addr); - /* instantiate_type will always return a plain function; pretend it's - overloaded. */ - if (TREE_CODE (fns) == FUNCTION_DECL) - fns = scratch_ovl_cons (fns, NULL_TREE); - fn = instantiate_type (fntype, fns, 0); if (fn != error_mark_node) |