// parameter type and the initializer element as its argument
//
// We've already removed references and cv-qualifiers here.
+ if (!ILE->getNumInits())
+ return Sema::TDK_Success;
+
QualType ElTy;
auto *ArrTy = S.Context.getAsArrayType(AdjustedParamType);
if (ArrTy)
// in the P0[N] case, if N is a non-type template parameter, N is deduced
// from the length of the initializer list.
- // FIXME: We're not supposed to get here if N would be deduced as 0.
if (auto *DependentArrTy = dyn_cast_or_null<DependentSizedArrayType>(ArrTy)) {
// Determine the array bound is something we can deduce.
if (NonTypeTemplateParmDecl *NTTP =
void f(C<T, U>); // expected-note {{failed template argument deduction}}
void g(A<int> a) { f(a); } // expected-error {{no match}}
}
+
+namespace deduction_from_empty_list {
+ template<int M, int N = 5> void f(int (&&)[N], int (&&)[N]) { // expected-note {{1 vs. 2}}
+ static_assert(M == N, "");
+ }
+
+ void test() {
+ f<5>({}, {});
+ f<1>({}, {0});
+ f<1>({0}, {});
+ f<1>({0}, {0});
+ f<1>({0}, {0, 1}); // expected-error {{no matching}}
+ }
+}