http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52008
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-21 13:06:10 UTC --- (In reply to comment #8) > There is no better or worse specialization - the first one is a primary > template, not a specialization. But if it were another partial specialization, it would not be less specialized, and I think a partial specialization must be more specialized than a hypothetical partial specialization form of the primary template. > The example of tuple_slice<1, int, int, int> will just not match the > specialization with first argument 0 because, simply, here the first argument > is 1. Right, that one isn't ambiguous, but then it leads to the instantiation of tuple_slice<0,int,int> which is. > 2. The code is rejected the following way: the template specialization > definition is itself rejected because due to not covered explicitly all > explicit parameters (that is, all but parameter pack) this is not considered > template specialization. Right, because the partial specialization doesn't specialize the Type1 parameter, it is not more specialized than the primary template. You should rewrite your code the way I did, and then do something to address the ambiguity; possibly a third partial specialization.