c++: optimize unifying nested templated classes [PR89231]
Since the LHS of a qualified-id is a non-deduced context, it effectively means we can't deduce from outer template arguments of a class template specialization. And checking for equality between the TI_TEMPLATE of a class specialization parm/arg already implies that the outer template arguments are the same. Hence recursing into outer template arguments during unification of class specializations is redundant, so this patch makes unify recurse only into innermost arguments. This incidentally fixes the testcase from PR89231 because there more_specialized_partial_inst wrongly considers the two partial specializations to be unordered ultimately because unify for identical parm=arg=A<Ps...>::Collect<N...> gets confused when it recurses into parm=arg={Ps...} since Ps is outside the (innermost) level of tparms that we're actually deducing. PR c++/89231 gcc/cp/ChangeLog: * pt.cc (try_class_unification): Strengthen TI_TEMPLATE equality test by not calling most_general_template. Only unify the innermost levels of template arguments. (unify) <case CLASS_TYPE>: Only unify the innermost levels of template arguments, and only if the template is primary. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-partial3.C: New test.
Loading
Please register or sign in to comment