{
static hashval_t hash (norm_entry *e)
{
- hashval_t hash = iterative_hash_template_arg (e->tmpl, 0);
- return iterative_hash_template_arg (e->args, hash);
+ ++comparing_specializations;
+ hashval_t val = iterative_hash_template_arg (e->tmpl, 0);
+ val = iterative_hash_template_arg (e->args, val);
+ --comparing_specializations;
+ return val;
}
static bool equal (norm_entry *e1, norm_entry *e2)
{
- return e1->tmpl == e2->tmpl
+ ++comparing_specializations;
+ bool eq = e1->tmpl == e2->tmpl
&& template_args_equal (e1->args, e2->args);
+ --comparing_specializations;
+ return eq;
}
};
{
static hashval_t hash (sat_entry *e)
{
+ auto cso = make_temp_override (comparing_specializations);
+ ++comparing_specializations;
+
if (ATOMIC_CONSTR_MAP_INSTANTIATED_P (e->atom))
{
/* Atoms with instantiated mappings are built during satisfaction.
static bool equal (sat_entry *e1, sat_entry *e2)
{
+ auto cso = make_temp_override (comparing_specializations);
+ ++comparing_specializations;
+
if (ATOMIC_CONSTR_MAP_INSTANTIATED_P (e1->atom)
!= ATOMIC_CONSTR_MAP_INSTANTIATED_P (e2->atom))
return false;
{
static hashval_t hash (tree t)
{
- return hash_atomic_constraint (t);
+ ++comparing_specializations;
+ hashval_t val = hash_atomic_constraint (t);
+ --comparing_specializations;
+ return val;
}
static bool equal (tree t1, tree t2)
{
- return atomic_constraints_identical_p (t1, t2);
+ ++comparing_specializations;
+ bool eq = atomic_constraints_identical_p (t1, t2);
+ --comparing_specializations;
+ return eq;
}
};
{
static hashval_t hash (tree t)
{
+ ++comparing_specializations;
tree_code code = TREE_CODE (t);
hashval_t val = iterative_hash_object (code, 0);
val = iterative_hash_object (TEMPLATE_TYPE_LEVEL (t), val);
val = iterative_hash_object (TEMPLATE_TYPE_IDX (t), val);
if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
val = iterative_hash_template_arg (TYPE_TI_ARGS (t), val);
+ --comparing_specializations;
return val;
}
static bool equal (tree t, tree u)
{
- return comptypes (t, u, COMPARE_STRUCTURAL);
+ ++comparing_specializations;
+ bool eq = comptypes (t, u, COMPARE_STRUCTURAL);
+ --comparing_specializations;
+ return eq;
}
};
--- /dev/null
+// PR c++/107539
+// { dg-do compile { target c++11 } }
+
+template<class T>
+struct A { };
+
+template<template<class> class C>
+struct B {
+ template<class T>
+ void f(T t) {
+ A<C<decltype(t)>> a1;
+ }
+
+ template<class T>
+ void g(T t) {
+ A<C<decltype(t)>> a2;
+ }
+};