1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
6 ConstCopy
&operator=(const ConstCopy
&);
11 NonConstCopy
&operator=(NonConstCopy
&);
14 struct VirtualInheritsNonConstCopy
: virtual NonConstCopy
{
15 VirtualInheritsNonConstCopy();
16 VirtualInheritsNonConstCopy
&operator=(const VirtualInheritsNonConstCopy
&);
19 struct ImplicitNonConstCopy1
: NonConstCopy
{ // expected-note{{the implicit copy assignment operator}}
20 ImplicitNonConstCopy1();
23 struct ImplicitNonConstCopy2
{ // expected-note{{the implicit copy assignment operator}}
24 ImplicitNonConstCopy2();
28 struct ImplicitNonConstCopy3
{ // expected-note{{the implicit copy assignment operator}}
29 ImplicitNonConstCopy3();
30 NonConstCopy ncc_array
[2][3];
33 struct ImplicitNonConstCopy4
: VirtualInheritsNonConstCopy
{
34 ImplicitNonConstCopy4();
37 void test_non_const_copy(const ImplicitNonConstCopy1
&cincc1
,
38 const ImplicitNonConstCopy2
&cincc2
,
39 const ImplicitNonConstCopy3
&cincc3
,
40 const ImplicitNonConstCopy4
&cincc4
,
41 const VirtualInheritsNonConstCopy
&vincc
) {
42 (void)sizeof(ImplicitNonConstCopy1() = cincc1
); // expected-error{{no viable overloaded '='}}
43 (void)sizeof(ImplicitNonConstCopy2() = cincc2
); // expected-error{{no viable overloaded '='}}
44 (void)sizeof(ImplicitNonConstCopy3() = cincc3
); // expected-error{{no viable overloaded '='}}
45 (void)sizeof(ImplicitNonConstCopy4() = cincc4
); // okay
46 (void)sizeof(VirtualInheritsNonConstCopy() = vincc
);