Commit b06a1f50 by Jason Merrill Committed by Jason Merrill

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
parent 3a2cb4d0
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.
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment