aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/special/class.copy/implicit-move-def.cpp
blob: 1f91945b4a9f76c3fde96516122606e53de39cfb (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// RUN: %clang_cc1 -emit-llvm -o - -std=c++0x %s | FileCheck -check-prefix=CHECK-ASSIGN %s
// RUN: %clang_cc1 -emit-llvm -o - -std=c++0x %s | FileCheck -check-prefix=CHECK-CTOR %s

// construct

struct E {
  E();
  E(E&&);
};

struct F {
  F();
  F(F&&);
};

struct G {
  E e;
};

struct H : G {
  F l;
  E m;
  F ar[2];
};

void f() {
  H s;
  // CHECK: call void @_ZN1HC1EOS_
  H t(static_cast<H&&>(s));
}


// assign

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

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

struct C {
  A a;
};

struct D : C {
  A a;
  B b;
  A ar[2];
};

void g() {
  D d;
  // CHECK: call {{.*}} @_ZN1DaSEOS_
  d = D();
}

// PR10822
struct I {
  unsigned var[1];
};

void h() {
  I i;
  i = I();
}

// move assignment ops

// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1DaSEOS_
// CHECK-ASSIGN: call {{.*}} @_ZN1CaSEOS_
// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
// CHECK-ASSIGN: call {{.*}} @_ZN1BaSEOS_
// array loop
// CHECK-ASSIGN: br i1
// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_

// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1IaSEOS_
// call void @llvm.memcpy.

// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1CaSEOS_
// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_

// move ctors

// CHECK-CTOR: define linkonce_odr void @_ZN1HC2EOS_
// CHECK-CTOR: call void @_ZN1GC2EOS_
// CHECK-CTOR: call void @_ZN1FC1EOS_
// CHECK-CTOR: call void @_ZN1EC1EOS_
// array loop
// CHECK-CTOR: br i1
// CHECK-CTOR: call void @_ZN1FC1EOS_

// CHECK-CTOR: define linkonce_odr void @_ZN1GC2EOS_
// CHECK-CTOR: call void @_ZN1EC1EOS_