// 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())
x = xi;
x = xl;
x = xmptr; // expected-note{{instantiation}}
-}
\ No newline at end of file
+}
+
+struct X1 {
+ X1 &operator=(const X1&);
+};
+
+template<typename T>
+struct X2 : X1 {
+ template<typename U> X2 &operator=(const U&);
+};
+
+struct X3 : X2<int> {
+};
+
+void test_X2(X3 &to, X3 from) {
+ to = from;
+}