From 830bfa74b082c1cd0d5550ee4f0f4364f46f1a0a Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 11 May 1998 07:25:25 +0000 Subject: call.c (add_template_candidate): Adjust for changes to fn_type_unification. * call.c (add_template_candidate): Adjust for changes to fn_type_unification. (add_template_candidate_real): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Likewise. (build_new_function_call): Likewise. (build_object_call): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. * class.c (instantiate_type): Likewise. * cp-tree.h (unification_kind_t): New type. (fn_type_unification): Adjust prototype. (type_unificaiton): Likewise. * pt.c (UNIFY_ALLOW_NONE): New macro. (UNIFY_ALLOW_MORE_CV_QUAL): Likewise. (UNIFY_ALLOW_LESS_CV_QUAL): Likewise. (UNIFY_ALLOW_DERIVED): Likewise. (unify): Change prototype. (maybe_adjust_types_for_deduction): New function. (check_cv_quals_for_unify): Likewise. (determine_specialization): Adjust. (fn_type_unification): Likewise. (type_unification): Likewise. (type_unification_real): Likewise. Use maybe_adjust_types_for_deduction. Fix mishandling of back-unification of template functions passed as arguments. Pass appropriate combination of UNIFY_ALLOW_* to unify. (unify): Remove unused NTPARMS parameter. Use check_cv_quals_for_unify. Remove bogus code that allowed too-generous unification in order to adhere more closely to standard. (get_bindings_real): Adjust. (get_class_bindings): Likewise. * method.c (build_overload_identifier): Only use the innermost template arguments when mangling. * pt.c (tsubst_template_argument_vector): New function. (complete_template_args): Deal with the situation where the extra_args contain more than one level of arguments. (lookup_template_class): Deal with member template classes, which may have more than one level of arguments. (tsubst): Don't tsbust into the TREE_TYPE of an IDENTIFIER_NODE. Improve handling of member template classes. Use DECL_PRIMARY_TEMPLATE instead of inline expansion. Use tsubst_template_argument_vector where appropriate. (regenerate_decl_from_template): Break out from ... (instantiate_decl): Here. From-SVN: r19663 --- gcc/cp/call.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'gcc/cp/call.c') diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e9ca9af..5eafd87 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -61,9 +61,11 @@ static tree build_this PROTO((tree)); static struct z_candidate * splice_viable PROTO((struct z_candidate *)); static int any_viable PROTO((struct z_candidate *)); static struct z_candidate * add_template_candidate - PROTO((struct z_candidate *, tree, tree, tree, tree, int)); + PROTO((struct z_candidate *, tree, tree, tree, tree, int, + unification_kind_t)); static struct z_candidate * add_template_candidate_real - PROTO((struct z_candidate *, tree, tree, tree, tree, int, tree)); + PROTO((struct z_candidate *, tree, tree, tree, tree, int, + tree, unification_kind_t)); static struct z_candidate * add_template_conv_candidate PROTO((struct z_candidate *, tree, tree, tree, tree)); static struct z_candidate * add_builtin_candidates @@ -1865,11 +1867,12 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags) static struct z_candidate* add_template_candidate_real (candidates, tmpl, explicit_targs, arglist, return_type, flags, - obj) + obj, strict) struct z_candidate *candidates; tree tmpl, explicit_targs, arglist, return_type; int flags; tree obj; + unification_kind_t strict; { int ntparms = DECL_NTPARMS (tmpl); tree targs = make_scratch_vec (ntparms); @@ -1878,7 +1881,7 @@ add_template_candidate_real (candidates, tmpl, explicit_targs, tree fn; i = fn_type_unification (tmpl, explicit_targs, targs, arglist, - return_type, 0, NULL_TREE); + return_type, strict, NULL_TREE); if (i != 0) return candidates; @@ -1920,14 +1923,16 @@ add_template_candidate_real (candidates, tmpl, explicit_targs, static struct z_candidate * add_template_candidate (candidates, tmpl, explicit_targs, - arglist, return_type, flags) + arglist, return_type, flags, strict) struct z_candidate *candidates; tree tmpl, explicit_targs, arglist, return_type; int flags; + unification_kind_t strict; { return add_template_candidate_real (candidates, tmpl, explicit_targs, - arglist, return_type, flags, NULL_TREE); + arglist, return_type, flags, + NULL_TREE, strict); } @@ -1938,7 +1943,7 @@ add_template_conv_candidate (candidates, tmpl, obj, arglist, return_type) { return add_template_candidate_real (candidates, tmpl, NULL_TREE, arglist, - return_type, 0, obj); + return_type, 0, obj, DEDUCE_CONV); } @@ -2058,7 +2063,8 @@ build_user_type_conversion_1 (totype, expr, flags) templates = scratch_tree_cons (NULL_TREE, ctor, templates); candidates = add_template_candidate (candidates, ctor, - NULL_TREE, args, NULL_TREE, flags); + NULL_TREE, args, NULL_TREE, flags, + DEDUCE_CALL); } else candidates = add_function_candidate (candidates, ctor, @@ -2107,7 +2113,8 @@ build_user_type_conversion_1 (totype, expr, flags) templates = scratch_tree_cons (NULL_TREE, fn, templates); candidates = add_template_candidate (candidates, fn, NULL_TREE, - args, totype, flags); + args, totype, flags, + DEDUCE_CONV); } else candidates = add_function_candidate (candidates, fn, @@ -2261,7 +2268,7 @@ build_new_function_call (fn, args) templates = scratch_tree_cons (NULL_TREE, t, templates); candidates = add_template_candidate (candidates, t, explicit_targs, args, NULL_TREE, - LOOKUP_NORMAL); + LOOKUP_NORMAL, DEDUCE_CALL); } else if (! template_only) candidates = add_function_candidate @@ -2346,7 +2353,7 @@ build_object_call (obj, args) candidates = add_template_candidate (candidates, fn, NULL_TREE, mem_args, NULL_TREE, - LOOKUP_NORMAL); + LOOKUP_NORMAL, DEDUCE_CALL); } else candidates = add_function_candidate @@ -2603,7 +2610,7 @@ build_new_op (code, flags, arg1, arg2, arg3) candidates = add_template_candidate (candidates, fn, NULL_TREE, arglist, TREE_TYPE (fnname), - flags); + flags, DEDUCE_CALL); } else candidates = add_function_candidate (candidates, fn, arglist, flags); @@ -2639,7 +2646,7 @@ build_new_op (code, flags, arg1, arg2, arg3) candidates = add_template_candidate (candidates, fn, NULL_TREE, this_arglist, TREE_TYPE (fnname), - flags); + flags, DEDUCE_CALL); } else candidates = add_function_candidate @@ -3591,7 +3598,7 @@ build_new_method_call (instance, name, args, basetype_path, flags) candidates = add_template_candidate (candidates, t, explicit_targs, this_arglist, - TREE_TYPE (name), flags); + TREE_TYPE (name), flags, DEDUCE_CALL); } else if (! template_only) candidates = add_function_candidate (candidates, t, -- cgit v1.1