diff options
author | kan <kan@FreeBSD.org> | 2007-08-14 02:45:23 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2007-08-14 02:45:23 +0000 |
commit | d2ff90cc580c62afb8528917c1c80ac49d9aaa01 (patch) | |
tree | 7b2fa7d3de8706d9ca72fdb284ce2a57f67d460a /contrib/gcc/cp/pt.c | |
parent | 8a2681fa7ee14c49235e12318f7de5a9a7f492ea (diff) | |
download | FreeBSD-src-d2ff90cc580c62afb8528917c1c80ac49d9aaa01.zip FreeBSD-src-d2ff90cc580c62afb8528917c1c80ac49d9aaa01.tar.gz |
GCC 4.2.1 release.
Diffstat (limited to 'contrib/gcc/cp/pt.c')
-rw-r--r-- | contrib/gcc/cp/pt.c | 77 |
1 files changed, 44 insertions, 33 deletions
diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c index cca1f38..477265d 100644 --- a/contrib/gcc/cp/pt.c +++ b/contrib/gcc/cp/pt.c @@ -91,8 +91,8 @@ static htab_t local_specializations; static void push_access_scope (tree); static void pop_access_scope (tree); -static int resolve_overloaded_unification (tree, tree, tree, tree, - unification_kind_t, int); +static bool resolve_overloaded_unification (tree, tree, tree, tree, + unification_kind_t, int); static int try_one_overload (tree, tree, tree, tree, tree, unification_kind_t, int, bool); static int unify (tree, tree, tree, tree, int); @@ -9943,17 +9943,18 @@ type_unification_real (tree tparms, gcc_assert (TREE_TYPE (arg) != NULL_TREE); if (type_unknown_p (arg)) { - /* [temp.deduct.type] A template-argument can be deduced from - a pointer to function or pointer to member function - argument if the set of overloaded functions does not - contain function templates and at most one of a set of - overloaded functions provides a unique match. */ + /* [temp.deduct.type] + A template-argument can be deduced from a pointer to + function or pointer to member function argument if + the set of overloaded functions does not contain + function templates and at most one of a set of + overloaded functions provides a unique match. */ if (resolve_overloaded_unification - (tparms, targs, parm, arg, strict, sub_strict) - != 0) - return 1; - continue; + (tparms, targs, parm, arg, strict, sub_strict)) + continue; + + return 1; } arg = unlowered_expr_type (arg); if (arg == error_mark_node) @@ -10006,12 +10007,13 @@ type_unification_real (tree tparms, return 0; } -/* Subroutine of type_unification_real. Args are like the variables at the - call site. ARG is an overloaded function (or template-id); we try - deducing template args from each of the overloads, and if only one - succeeds, we go with that. Modifies TARGS and returns 0 on success. */ +/* Subroutine of type_unification_real. Args are like the variables + at the call site. ARG is an overloaded function (or template-id); + we try deducing template args from each of the overloads, and if + only one succeeds, we go with that. Modifies TARGS and returns + true on success. */ -static int +static bool resolve_overloaded_unification (tree tparms, tree targs, tree parm, @@ -10070,16 +10072,17 @@ resolve_overloaded_unification (tree tparms, } } } + else if (TREE_CODE (arg) != OVERLOAD + && TREE_CODE (arg) != FUNCTION_DECL) + /* If ARG is, for example, "(0, &f)" then its type will be unknown + -- but the deduction does not succeed because the expression is + not just the function on its own. */ + return false; else - { - gcc_assert (TREE_CODE (arg) == OVERLOAD - || TREE_CODE (arg) == FUNCTION_DECL); - - for (; arg; arg = OVL_NEXT (arg)) - good += try_one_overload (tparms, targs, tempargs, parm, - TREE_TYPE (OVL_CURRENT (arg)), - strict, sub_strict, addr_p); - } + for (; arg; arg = OVL_NEXT (arg)) + good += try_one_overload (tparms, targs, tempargs, parm, + TREE_TYPE (OVL_CURRENT (arg)), + strict, sub_strict, addr_p); /* [temp.deduct.type] A template-argument can be deduced from a pointer to function or pointer to member function argument if the set of @@ -10097,9 +10100,9 @@ resolve_overloaded_unification (tree tparms, TREE_VEC_ELT (targs, i) = TREE_VEC_ELT (tempargs, i); } if (good) - return 0; + return true; - return 1; + return false; } /* Subroutine of resolve_overloaded_unification; does deduction for a single @@ -12895,12 +12898,7 @@ value_dependent_expression_p (tree expression) } if (TREE_CODE (expression) == TREE_LIST) - { - for (; expression; expression = TREE_CHAIN (expression)) - if (value_dependent_expression_p (TREE_VALUE (expression))) - return true; - return false; - } + return any_value_dependent_elements_p (expression); return value_dependent_expression_p (expression); } @@ -13104,6 +13102,19 @@ any_type_dependent_arguments_p (tree args) return false; } +/* Returns TRUE if LIST (a TREE_LIST whose TREE_VALUEs are + expressions) contains any value-dependent expressions. */ + +bool +any_value_dependent_elements_p (tree list) +{ + for (; list; list = TREE_CHAIN (list)) + if (value_dependent_expression_p (TREE_VALUE (list))) + return true; + + return false; +} + /* Returns TRUE if the ARG (a template argument) is dependent. */ static bool |