Skip to content
Snippets Groups Projects
Commit 80968d5f authored by Patrick Palka's avatar Patrick Palka
Browse files

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.
parent 6e92a6a2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment