1 // RUN: %check_clang_tidy %s performance-noexcept-move-constructor %t
2
3 struct C_1 {
~C_1C_14 ~C_1() {}
C_1C_15 C_1(int a) {}
C_1C_16 C_1(C_1&& a) :C_1(5) {}
7 // CHECK-FIXES: ){{.*}}noexcept{{.*}}:
operator =C_18 C_1& operator=(C_1&&) { return *this; }
9 // CHECK-FIXES: ){{.*}}noexcept{{.*}} {
10 };
11
12 struct C_2 {
~C_2C_213 ~C_2() {}
14 C_2(C_2&& a);
15 // CHECK-FIXES: ){{.*}}noexcept{{.*}};
16 C_2& operator=(C_2&&);
17 // CHECK-FIXES: ){{.*}}noexcept{{.*}};
18 };
19
C_2(C_2 && a)20 C_2::C_2(C_2&& a) {}
21 // CHECK-FIXES: ){{.*}}noexcept{{.*}} {}
operator =(C_2 &&)22 C_2& C_2::operator=(C_2&&) { return *this; }
23 // CHECK-FIXES: ){{.*}}noexcept{{.*}} {
24
25 struct C_3 {
~C_3C_326 ~C_3() {}
27 C_3(C_3&& a);
28 // CHECK-FIXES: ){{.*}}noexcept{{.*}};
29 C_3& operator=(C_3&& a);
30 // CHECK-FIXES: ){{.*}}noexcept{{.*}};
31 };
32
33 C_3::C_3(C_3&& a) = default;
34 // CHECK-FIXES: ){{.*}}noexcept{{.*}} = default;
35 C_3& C_3::operator=(C_3&& a) = default;
36 // CHECK-FIXES: ){{.*}}noexcept{{.*}} = default;
37
38 template <class T>
39 struct C_4 {
C_4C_440 C_4(C_4<T>&&) {}
41 // CHECK-FIXES: ){{.*}}noexcept{{.*}} {}
~C_4C_442 ~C_4() {}
43 C_4& operator=(C_4&& a) = default;
44 // CHECK-FIXES: ){{.*}}noexcept{{.*}} = default;
45 };
46
47 template <class T>
48 struct C_5 {
C_5C_549 C_5(C_5<T>&&) {}
50 // CHECK-FIXES:){{.*}}noexcept{{.*}} {}
~C_5C_551 ~C_5() {}
52 auto operator=(C_5&& a)->C_5<T> = default;
53 // CHECK-FIXES:){{.*}}noexcept{{.*}} = default;
54 };
55
56 template <class T>
57 struct C_6 {
C_6C_658 C_6(C_6<T>&&) {}
59 // CHECK-FIXES:){{.*}}noexcept{{.*}} {}
~C_6C_660 ~C_6() {}
61 auto operator=(C_6&& a)->C_6<T>;
62 // CHECK-FIXES:){{.*}}noexcept{{.*}};
63 };
64
65 template <class T>
operator =(C_6<T> && a)66 auto C_6<T>::operator=(C_6<T>&& a) -> C_6<T> {}
67 // CHECK-FIXES: ){{.*}}noexcept{{.*}} {}