1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s 2*67e74705SXin Li 3*67e74705SXin Li // Make sure that copy constructors and assignment operators are properly 4*67e74705SXin Li // generated when there is a matching 5*67e74705SXin Li 6*67e74705SXin Li // PR5072 7*67e74705SXin Li template<typename T> 8*67e74705SXin Li struct X { 9*67e74705SXin Li template<typename U> XX10*67e74705SXin Li X(const X<U>& other) 11*67e74705SXin Li : value(other.value + 1) { } // expected-error{{binary expression}} 12*67e74705SXin Li 13*67e74705SXin Li template<typename U> operator =X14*67e74705SXin Li X& operator=(const X<U>& other) { 15*67e74705SXin Li value = other.value + 1; // expected-error{{binary expression}} 16*67e74705SXin Li return *this; 17*67e74705SXin Li } 18*67e74705SXin Li 19*67e74705SXin Li T value; 20*67e74705SXin Li }; 21*67e74705SXin Li 22*67e74705SXin Li struct Y {}; 23*67e74705SXin Li test0(X<int Y::* > x)24*67e74705SXin LiX<int Y::*> test0(X<int Y::*> x) { return x; } test1(X<long> x)25*67e74705SXin LiX<int> test1(X<long> x) { return x; } 26*67e74705SXin Li 27*67e74705SXin Li test2(X<int Y::* > x)28*67e74705SXin LiX<int> test2(X<int Y::*> x) { 29*67e74705SXin Li return x; // expected-note{{instantiation}} 30*67e74705SXin Li } 31*67e74705SXin Li test3(X<int> & x,X<int> xi,X<long> xl,X<int Y::* > xmptr)32*67e74705SXin Livoid test3(X<int> &x, X<int> xi, X<long> xl, X<int Y::*> xmptr) { 33*67e74705SXin Li x = xi; 34*67e74705SXin Li x = xl; 35*67e74705SXin Li x = xmptr; // expected-note{{instantiation}} 36*67e74705SXin Li } 37*67e74705SXin Li 38*67e74705SXin Li struct X1 { 39*67e74705SXin Li X1 &operator=(const X1&); 40*67e74705SXin Li }; 41*67e74705SXin Li 42*67e74705SXin Li template<typename T> 43*67e74705SXin Li struct X2 : X1 { 44*67e74705SXin Li template<typename U> X2 &operator=(const U&); 45*67e74705SXin Li }; 46*67e74705SXin Li 47*67e74705SXin Li struct X3 : X2<int> { 48*67e74705SXin Li }; 49*67e74705SXin Li test_X2(X3 & to,X3 from)50*67e74705SXin Livoid test_X2(X3 &to, X3 from) { 51*67e74705SXin Li to = from; 52*67e74705SXin Li } 53