From: Jason Merrill Date: Fri, 8 Apr 2011 06:08:21 +0000 (-0400) Subject: re PR c++/48481 (C++ overloading memory hog) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b06a1f50c5030b27e307c86ab49eb16a6b32fc56;p=gcc.git re PR c++/48481 (C++ overloading memory hog) PR c++/48481 * tree.c (build_overload): Allow an unwrapped FUNCTION_DECL at the end of the chain. * pt.c (dependent_template_p): Use OVL_CURRENT/NEXT. (iterative_hash_template_arg): Likewise. From-SVN: r172164 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 307272bef42..027eac822fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2011-04-07 Jason Merrill + PR c++/48481 + * tree.c (build_overload): Allow an unwrapped FUNCTION_DECL + at the end of the chain. + * pt.c (dependent_template_p): Use OVL_CURRENT/NEXT. + (iterative_hash_template_arg): Likewise. + PR c++/48481 * cp-tree.h (OVL_ARG_DEPENDENT): New. * name-lookup.c (add_function): Set it. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 696a8f5fdcb..2136df62118 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -5139,8 +5139,8 @@ arg_assoc (struct arg_lookup *k, tree n) } else if (TREE_CODE (n) == OVERLOAD) { - for (; n; n = OVL_CHAIN (n)) - if (arg_assoc_type (k, TREE_TYPE (OVL_FUNCTION (n)))) + for (; n; n = OVL_NEXT (n)) + if (arg_assoc_type (k, TREE_TYPE (OVL_CURRENT (n)))) return true; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4edd4045ca9..86274e99731 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1516,8 +1516,8 @@ iterative_hash_template_arg (tree arg, hashval_t val) return val; case OVERLOAD: - for (; arg; arg = OVL_CHAIN (arg)) - val = iterative_hash_template_arg (OVL_FUNCTION (arg), val); + for (; arg; arg = OVL_NEXT (arg)) + val = iterative_hash_template_arg (OVL_CURRENT (arg), val); return val; case CONSTRUCTOR: @@ -18591,9 +18591,9 @@ dependent_template_p (tree tmpl) { while (tmpl) { - if (dependent_template_p (OVL_FUNCTION (tmpl))) + if (dependent_template_p (OVL_CURRENT (tmpl))) return true; - tmpl = OVL_CHAIN (tmpl); + tmpl = OVL_NEXT (tmpl); } return false; } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 014986dc318..3594ae42dd5 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1461,8 +1461,6 @@ build_overload (tree decl, tree chain) { if (! chain && TREE_CODE (decl) != TEMPLATE_DECL) return decl; - if (chain && TREE_CODE (chain) != OVERLOAD) - chain = ovl_cons (chain, NULL_TREE); return ovl_cons (decl, chain); }