1 // RUN: %check_clang_tidy %s performance-noexcept-move-constructor %t -- -- -fexceptions
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 C_3& C_3::operator=(C_3&& a) = default;
35
36 template <class T>
37 struct C_4 {
C_4C_438 C_4(C_4<T>&&) {}
39 // CHECK-FIXES: ){{.*}}noexcept{{.*}} {}
~C_4C_440 ~C_4() {}
41 C_4& operator=(C_4&& a) = default;
42 };
43
44 template <class T>
45 struct C_5 {
C_5C_546 C_5(C_5<T>&&) {}
47 // CHECK-FIXES:){{.*}}noexcept{{.*}} {}
~C_5C_548 ~C_5() {}
49 auto operator=(C_5&& a)->C_5<T> = default;
50 };
51
52 template <class T>
53 struct C_6 {
C_6C_654 C_6(C_6<T>&&) {}
55 // CHECK-FIXES:){{.*}}noexcept{{.*}} {}
~C_6C_656 ~C_6() {}
57 auto operator=(C_6&& a)->C_6<T>;
58 // CHECK-FIXES:){{.*}}noexcept{{.*}};
59 };
60
61 template <class T>
operator =(C_6<T> && a)62 auto C_6<T>::operator=(C_6<T>&& a) -> C_6<T> {}
63 // CHECK-FIXES: ){{.*}}noexcept{{.*}} {}
64