When looking for a copy-assignment operator to determine the cv-qualifiers on its argument type, ignore assignment operator templates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85629 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 2e3bbce..b4c0c59 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -189,7 +189,10 @@
     //   A user-declared copy assignment operator is a non-static non-template
     //   member function of class X with exactly one parameter of type X, X&,
     //   const X&, volatile X& or const volatile X&.
-    const CXXMethodDecl* Method = cast<CXXMethodDecl>(*Op);
+    const CXXMethodDecl* Method = dyn_cast<CXXMethodDecl>(*Op);
+    if (!Method)
+      continue;
+
     if (Method->isStatic())
       continue;
     if (Method->getPrimaryTemplate())