aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/implicit12.C
blob: d52f1532d46375792dc4bcaedaa2f18e9c8a45e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// PR c++/50500
// { dg-do compile { target c++11 } }

// If a class declares move operations, the implicitly declared copy
// operations are deleted.
struct A
{
  A();
  A(A&&);
  A& operator=(A&&);
};

// But they can still be explicitly defaulted.
struct B
{
  B();
  B(B&&);
  B(const B&) = default;
  B& operator=(B&&);
  B& operator=(const B&) = default;
};

struct C
{
  C();
  C(C&&);
};

struct D
{
  D();
  D& operator=(D&&);
};

int main()
{
  A a;
  A a2 (a);			// { dg-error "deleted" }
  a2 = a;			// { dg-error "deleted" }

  B b;
  B b2 (b);
  b2 = b;

  C c;
  C c2(c);			// { dg-error "deleted" }
  c2 = c;			// { dg-error "deleted" }

  D d;
  D d2(d);			// { dg-error "deleted" }
  d2 = d;			// { dg-error "deleted" }
}

// { dg-prune-output "because" }