1 // RUN: clang-cc -fsyntax-only -verify %s
2 
3 class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}} \
4              // expected-note {{synthesized method is first required here}}
5   int &ref;  // expected-note {{declared at}}
6 };
7 
8 class X  : Base {  // // expected-error {{cannot define the implicit default assignment operator for 'class X'}}
9 public:
10   X();
11   const int cint;  // expected-note {{declared at}}
12 };
13 
14 struct Y  : X {
15   Y();
16   Y& operator=(const Y&);
17   Y& operator=(volatile Y&);
18   Y& operator=(const volatile Y&);
19   Y& operator=(Y&);
20 };
21 
22 class Z : Y {};
23 
24 Z z1;
25 Z z2;
26 
27 // Test1
28 void f(X x, const X cx) {
29   x = cx;	// expected-note {{synthesized method is first required here}}
30   x = cx;
31   z1 = z2;
32 }
33 
34 // Test2
35 class T {};
36 T t1;
37 T t2;
38 
39 void g()
40 {
41   t1 = t2;
42 }
43 
44 // Test3
45 class V {
46 public:
47   V();
48   V &operator = (V &b);
49 };
50 
51 class W : V {};
52 W w1, w2;
53 
54 void h()
55 {
56   w1 = w2;
57 }
58 
59 // Test4
60 
61 class B1 {
62 public:
63   B1();
64   B1 &operator = (B1 b);
65 };
66 
67 class D1 : B1 {};
68 D1 d1, d2;
69 
70 void i()
71 {
72 	d1 = d2;
73 }
74 
75 // Test5
76 
77 class E1 { // expected-error{{cannot define the implicit default assignment operator for 'class E1', because non-static const member 'a' can't use default assignment operator}}
78 public:
79   const int a; // expected-note{{declared at}}
80   E1() : a(0) {}
81 
82 };
83 
84 E1 e1, e2;
85 
86 void j()
87 {
88   e1 = e2; // expected-note{{synthesized method is first required here}}
89 }
90 
91