Move the checking of overridden virtual functions into the code path
common to both parsing and template instantiation, so that we'll find
overridden virtuals for member functions of class templates when they
are instantiated. 

Additionally, factor out the checking for pure virtual functions, so
that it will be executed both at parsing time and at template
instantiation time. 

These changes fix PR5656 (for real), although one more tweak
w.r.t. member function templates will be coming along shortly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90241 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index a125857..615c6f9 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -863,6 +863,9 @@
   SemaRef.CheckFunctionDeclaration(Method, Previous, false, Redeclaration,
                                    /*FIXME:*/OverloadableAttrRequired);
 
+  if (D->isPure())
+    SemaRef.CheckPureMethod(Method, SourceRange());
+
   if (!FunctionTemplate && (!Method->isInvalidDecl() || Previous.empty()) &&
       !Method->getFriendObjectKind())
     Owner->addDecl(Method);
@@ -1359,10 +1362,6 @@
     Record->setEmpty(false);
     Record->setPolymorphic(true);
   }
-  if (Tmpl->isPure()) {
-    New->setPure();
-    Record->setAbstract(true);
-  }
 
   // FIXME: attributes
   // FIXME: New needs a pointer to Tmpl