1*0786d5b9SRichard Smith // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 2*0786d5b9SRichard Smith // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 319ecba74SDouglas Gregor 419ecba74SDouglas Gregor struct ConstCopy { 519ecba74SDouglas Gregor ConstCopy(); 619ecba74SDouglas Gregor ConstCopy &operator=(const ConstCopy&); 719ecba74SDouglas Gregor }; 819ecba74SDouglas Gregor 919ecba74SDouglas Gregor struct NonConstCopy { 1019ecba74SDouglas Gregor NonConstCopy(); 1119ecba74SDouglas Gregor NonConstCopy &operator=(NonConstCopy&); 1219ecba74SDouglas Gregor }; 1319ecba74SDouglas Gregor 1419ecba74SDouglas Gregor struct VirtualInheritsNonConstCopy : virtual NonConstCopy { 1519ecba74SDouglas Gregor VirtualInheritsNonConstCopy(); 1619ecba74SDouglas Gregor VirtualInheritsNonConstCopy &operator=(const VirtualInheritsNonConstCopy&); 1719ecba74SDouglas Gregor }; 1819ecba74SDouglas Gregor 1919ecba74SDouglas Gregor struct ImplicitNonConstCopy1 : NonConstCopy { // expected-note{{the implicit copy assignment operator}} 2019ecba74SDouglas Gregor ImplicitNonConstCopy1(); 2119ecba74SDouglas Gregor }; 2219ecba74SDouglas Gregor 2319ecba74SDouglas Gregor struct ImplicitNonConstCopy2 { // expected-note{{the implicit copy assignment operator}} 2419ecba74SDouglas Gregor ImplicitNonConstCopy2(); 2519ecba74SDouglas Gregor NonConstCopy ncc; 2619ecba74SDouglas Gregor }; 2719ecba74SDouglas Gregor 2819ecba74SDouglas Gregor struct ImplicitNonConstCopy3 { // expected-note{{the implicit copy assignment operator}} 2919ecba74SDouglas Gregor ImplicitNonConstCopy3(); 3019ecba74SDouglas Gregor NonConstCopy ncc_array[2][3]; 3119ecba74SDouglas Gregor }; 3219ecba74SDouglas Gregor 3319ecba74SDouglas Gregor struct ImplicitNonConstCopy4 : VirtualInheritsNonConstCopy { 3419ecba74SDouglas Gregor ImplicitNonConstCopy4(); 3519ecba74SDouglas Gregor }; 3619ecba74SDouglas Gregor test_non_const_copy(const ImplicitNonConstCopy1 & cincc1,const ImplicitNonConstCopy2 & cincc2,const ImplicitNonConstCopy3 & cincc3,const ImplicitNonConstCopy4 & cincc4,const VirtualInheritsNonConstCopy & vincc)3719ecba74SDouglas Gregorvoid test_non_const_copy(const ImplicitNonConstCopy1 &cincc1, 3819ecba74SDouglas Gregor const ImplicitNonConstCopy2 &cincc2, 3919ecba74SDouglas Gregor const ImplicitNonConstCopy3 &cincc3, 4019ecba74SDouglas Gregor const ImplicitNonConstCopy4 &cincc4, 4119ecba74SDouglas Gregor const VirtualInheritsNonConstCopy &vincc) { 4219ecba74SDouglas Gregor (void)sizeof(ImplicitNonConstCopy1() = cincc1); // expected-error{{no viable overloaded '='}} 4319ecba74SDouglas Gregor (void)sizeof(ImplicitNonConstCopy2() = cincc2); // expected-error{{no viable overloaded '='}} 4419ecba74SDouglas Gregor (void)sizeof(ImplicitNonConstCopy3() = cincc3); // expected-error{{no viable overloaded '='}} 4519ecba74SDouglas Gregor (void)sizeof(ImplicitNonConstCopy4() = cincc4); // okay 4619ecba74SDouglas Gregor (void)sizeof(VirtualInheritsNonConstCopy() = vincc); 4719ecba74SDouglas Gregor } 48