Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- lib/Sema/SemaTemplateInstantiateDecl.cpp	(revision 183862)
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp	(working copy)
@@ -3165,8 +3165,9 @@
     if (Init->isPackExpansion()) {
       // This is a pack expansion. We should expand it now.
       TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
-      SmallVector<UnexpandedParameterPack, 2> Unexpanded;
+      SmallVector<UnexpandedParameterPack, 2> Unexpanded, UnexpandedInit;
       collectUnexpandedParameterPacks(BaseTL, Unexpanded);
+      collectUnexpandedParameterPacks(Init->getInit(), UnexpandedInit);
       bool ShouldExpand = false;
       bool RetainExpansion = false;
       Optional<unsigned> NumExpansions;
@@ -3181,6 +3182,18 @@
         continue;
       }
       assert(ShouldExpand && "Partial instantiation of base initializer?");
+      if (CheckParameterPacksForExpansion(Init->getEllipsisLoc(),
+                                          BaseTL.getSourceRange(),
+                                          UnexpandedInit,
+                                          TemplateArgs, ShouldExpand,
+                                          RetainExpansion,
+                                          NumExpansions)) {
+        AnyErrors = true;
+        New->setInvalidDecl();
+        continue;
+      }
+      assert(ShouldExpand &&
+             "Partial instantiation of base initializer expression?");
 
       // Loop over all of the arguments in the argument pack(s),
       for (unsigned I = 0; I != *NumExpansions; ++I) {
Index: test/CXX/temp/temp.decls/temp.variadic/p5.cpp
===================================================================
--- test/CXX/temp/temp.decls/temp.variadic/p5.cpp	(revision 183862)
+++ test/CXX/temp/temp.decls/temp.variadic/p5.cpp	(working copy)
@@ -410,3 +410,14 @@
     f(h(args ...) + args ...);
   }
 }
+
+namespace PR16303 {
+  template<int> struct A { A(int); };
+  template<int...N> struct B {
+    template<int...M> struct C : A<N>... {
+      C() : A<N>(M)... {} // expected-error{{pack expansion contains parameter pack 'M' that has a different length (2 vs. 3) from outer parameter packs}} expected-error{{pack expansion contains parameter pack 'M' that has a different length (4 vs. 3) from outer parameter packs}}
+    };
+  };
+  B<1,2>::C<4,5,6> c1; // expected-note{{in instantiation of}}
+  B<1,2,3,4>::C<4,5,6> c2; // expected-note{{in instantiation of}}
+}
