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
This commit is contained in:
Jason Merrill 2011-04-08 02:08:21 -04:00 committed by Jason Merrill
parent 3a2cb4d037
commit b06a1f50c5
4 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,11 @@
2011-04-07 Jason Merrill <jason@redhat.com> 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 PR c++/48481
* cp-tree.h (OVL_ARG_DEPENDENT): New. * cp-tree.h (OVL_ARG_DEPENDENT): New.
* name-lookup.c (add_function): Set it. * name-lookup.c (add_function): Set it.

View File

@ -5139,8 +5139,8 @@ arg_assoc (struct arg_lookup *k, tree n)
} }
else if (TREE_CODE (n) == OVERLOAD) else if (TREE_CODE (n) == OVERLOAD)
{ {
for (; n; n = OVL_CHAIN (n)) for (; n; n = OVL_NEXT (n))
if (arg_assoc_type (k, TREE_TYPE (OVL_FUNCTION (n)))) if (arg_assoc_type (k, TREE_TYPE (OVL_CURRENT (n))))
return true; return true;
} }

View File

@ -1516,8 +1516,8 @@ iterative_hash_template_arg (tree arg, hashval_t val)
return val; return val;
case OVERLOAD: case OVERLOAD:
for (; arg; arg = OVL_CHAIN (arg)) for (; arg; arg = OVL_NEXT (arg))
val = iterative_hash_template_arg (OVL_FUNCTION (arg), val); val = iterative_hash_template_arg (OVL_CURRENT (arg), val);
return val; return val;
case CONSTRUCTOR: case CONSTRUCTOR:
@ -18591,9 +18591,9 @@ dependent_template_p (tree tmpl)
{ {
while (tmpl) while (tmpl)
{ {
if (dependent_template_p (OVL_FUNCTION (tmpl))) if (dependent_template_p (OVL_CURRENT (tmpl)))
return true; return true;
tmpl = OVL_CHAIN (tmpl); tmpl = OVL_NEXT (tmpl);
} }
return false; return false;
} }

View File

@ -1461,8 +1461,6 @@ build_overload (tree decl, tree chain)
{ {
if (! chain && TREE_CODE (decl) != TEMPLATE_DECL) if (! chain && TREE_CODE (decl) != TEMPLATE_DECL)
return decl; return decl;
if (chain && TREE_CODE (chain) != OVERLOAD)
chain = ovl_cons (chain, NULL_TREE);
return ovl_cons (decl, chain); return ovl_cons (decl, chain);
} }