summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/g++.dg/cpp0x/implicit12.C
blob: da806e006a6c96125802b48ea42b02ae95ff33bd (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-options "-std=c++0x" }

// 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" }
OpenPOWER on IntegriCloud