Make instantiating initializers for classes with a dependent base type 
work correctly.

The change in lib/AST/DeclCXX.cpp is mostly a large reindentation; I 
couldn't figure out a good way to avoid it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80446 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 5978dae..9785fb2 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1134,9 +1134,9 @@
     MemInitResult NewInit;
 
     if (Init->isBaseInitializer()) {
-      // FIXME: Type needs to be instantiated.
-      QualType BaseType = 
-        Context.getCanonicalType(QualType(Init->getBaseClass(), 0));
+      QualType BaseType(Init->getBaseClass(), 0);
+      BaseType = SubstType(BaseType, TemplateArgs, Init->getSourceLocation(),
+                           New->getDeclName());
 
       NewInit = BuildBaseInitializer(BaseType,
                                      (Expr **)NewArgs.data(),