@@ -5843,6 +5843,7 @@ struct GTY((for_user)) spec_entry
tree tmpl; /* The general template this is a specialization of. */
tree args; /* The args for this (maybe-partial) specialization. */
tree spec; /* The specialization itself. */
+ hashval_t hash;
};
/* in class.cc */
@@ -1739,7 +1739,7 @@ spec_hasher::hash (tree tmpl, tree args)
hashval_t
spec_hasher::hash (spec_entry *e)
{
- return spec_hasher::hash (e->tmpl, e->args);
+ return e->hash;
}
/* Recursively calculate a hash value for a template argument ARG, for use
@@ -10234,7 +10234,7 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context,
elt.tmpl = gen_tmpl;
elt.args = arglist;
elt.spec = NULL_TREE;
- hash = spec_hasher::hash (&elt);
+ hash = elt.hash = spec_hasher::hash (gen_tmpl, arglist);
entry = type_specializations->find_with_hash (&elt, hash);
if (entry)
@@ -10519,7 +10519,7 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context,
use it for hash table lookup. */
elt.tmpl = found;
elt.args = arglist = INNERMOST_TEMPLATE_ARGS (arglist);
- hash = spec_hasher::hash (&elt);
+ hash = elt.hash = spec_hasher::hash (found, arglist);
}
}