diff options
author | Jason Merrill <jason@redhat.com> | 2011-04-08 02:08:21 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-04-08 02:08:21 -0400 |
commit | b06a1f50c5030b27e307c86ab49eb16a6b32fc56 (patch) | |
tree | 1a7949b398e708ca97d0a00a9b02f404810cbde5 /gcc | |
parent | 3a2cb4d037cc66a0b6567d944cbc9450adf11814 (diff) | |
download | gcc-b06a1f50c5030b27e307c86ab49eb16a6b32fc56.zip gcc-b06a1f50c5030b27e307c86ab49eb16a6b32fc56.tar.gz gcc-b06a1f50c5030b27e307c86ab49eb16a6b32fc56.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 8 | ||||
-rw-r--r-- | gcc/cp/tree.c | 2 |
4 files changed, 12 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 307272b..027eac8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,12 @@ 2011-04-07 Jason Merrill <jason@redhat.com> 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. * semantics.c (finish_call_expr): Free OVERLOADs if it's set. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 696a8f5..2136df6 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 4edd404..86274e9 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 014986d..3594ae4 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); } |