if (!Deduced[I].isNull()) {
if (I < NumAlreadyConverted) {
- // We have already fully type-checked and converted this
- // argument, because it was explicitly-specified. Just record the
- // presence of this argument.
- Builder.push_back(Deduced[I]);
// We may have had explicitly-specified template arguments for a
// template parameter pack (that may or may not have been extended
// via additional deduced arguments).
- if (Param->isParameterPack() && CurrentInstantiationScope) {
- if (CurrentInstantiationScope->getPartiallySubstitutedPack() ==
- Param) {
- // Forget the partially-substituted pack; its substitution is now
- // complete.
- CurrentInstantiationScope->ResetPartiallySubstitutedPack();
- }
+ if (Param->isParameterPack() && CurrentInstantiationScope &&
+ CurrentInstantiationScope->getPartiallySubstitutedPack() == Param) {
+ // Forget the partially-substituted pack; its substitution is now
+ // complete.
+ CurrentInstantiationScope->ResetPartiallySubstitutedPack();
+ // We still need to check the argument in case it was extended by
+ // deduction.
+ } else {
+ // We have already fully type-checked and converted this
+ // argument, because it was explicitly-specified. Just record the
+ // presence of this argument.
+ Builder.push_back(Deduced[I]);
+ continue;
}
- continue;
}
- // We have deduced this argument, so it still needs to be
+ // We may have deduced this argument, so it still needs to be
// checked and converted.
if (ConvertDeducedTemplateArgument(S, Param, Deduced[I], Template, Info,
IsDeduced, Builder)) {
f<1>({0}, {0, 1}); // expected-error {{no matching}}
}
}
+
+namespace check_extended_pack {
+ template<typename T> struct X { typedef int type; };
+ template<typename ...T> void f(typename X<T>::type...);
+ template<typename T> void f(T, int, int);
+ void g() {
+ f<int>(0, 0, 0);
+ }
+
+ template<int, int*> struct Y {};
+ template<int ...N> void g(Y<N...>); // expected-note {{deduced non-type template argument does not have the same type as the corresponding template parameter ('int *' vs 'int')}}
+ int n;
+ void h() { g<0>(Y<0, &n>()); } // expected-error {{no matching function}}
+}