Fix handling of partially specialized class template.

When handling a partially specialized class template, the index of the
template parameter to be replaced was not properly calculated (confusion
between the overall index and the index within the non-specialized part).

This should fix ROOT-6019.