blob: 090ba3c3ca80116dc4472b80e00023fa9ed9bb62 [file] [log] [blame]
Fariborz Jahanian5a1bc7b2009-06-25 22:40:36 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3class 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
8class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'class X'}}
9public:
10 X();
11 const int cint; // expected-note {{declared at}}
12};
13
14struct 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
22class Z : Y {};
23
24Z z1;
25Z z2;
26
27// Test1
28void 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
35class T {};
36T t1;
37T t2;
38
39void g()
40{
41 t1 = t2;
42}
43
44// Test3
45class V {
46public:
47 V();
48 V &operator = (V &b);
49};
50
51class W : V {};
52W w1, w2;
53
54void h()
55{
56 w1 = w2;
57}
58
59// Test4
60
61class B1 {
62public:
63 B1();
64 B1 &operator = (B1 b);
65};
66
67class D1 : B1 {};
68D1 d1, d2;
69
70void i()
71{
72 d1 = d2;
73}
74