Don't assume that a base is always a RecordType, it can also be a TemplateSpecializationType. Also, make sure to get the instantiated union member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80662 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 8222814..99b237d 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1145,7 +1145,6 @@
       QualType BaseType(Init->getBaseClass(), 0);
       BaseType = SubstType(BaseType, TemplateArgs, Init->getSourceLocation(),
                            New->getDeclName());
-      BaseType = Context.getCanonicalType(BaseType);
 
       NewInit = BuildBaseInitializer(BaseType,
                                      (Expr **)NewArgs.data(), 
@@ -1158,7 +1157,7 @@
       
       // Is this an anonymous union?
       if (FieldDecl *UnionInit = Init->getAnonUnionMember())
-        Member = cast<FieldDecl>(UnionInit);
+        Member = cast<FieldDecl>(FindInstantiatedDecl(UnionInit));
       else
         Member = cast<FieldDecl>(FindInstantiatedDecl(Init->getMember()));