64 lines · cpp
1// RUN: %check_clang_tidy %s performance-noexcept-move-constructor %t -- -- -fexceptions2 3struct C_1 {4 ~C_1() {}5 C_1(int a) {}6 C_1(C_1&& a) :C_1(5) {}7 // CHECK-FIXES: C_1(C_1&& a) noexcept :C_1(5) {}8 C_1& operator=(C_1&&) { return *this; }9 // CHECK-FIXES: C_1& operator=(C_1&&) noexcept { return *this; }10};11 12struct C_2 {13 ~C_2() {}14 C_2(C_2&& a);15// CHECK-FIXES: C_2(C_2&& a) noexcept ;16 C_2& operator=(C_2&&);17// CHECK-FIXES: C_2& operator=(C_2&&) noexcept ;18};19 20C_2::C_2(C_2&& a) {}21// CHECK-FIXES: C_2::C_2(C_2&& a) noexcept {}22C_2& C_2::operator=(C_2&&) { return *this; }23// CHECK-FIXES: C_2& C_2::operator=(C_2&&) noexcept { return *this; }24 25struct C_3 {26 ~C_3() {}27 C_3(C_3&& a);28// CHECK-FIXES: C_3(C_3&& a) noexcept ;29 C_3& operator=(C_3&& a);30// CHECK-FIXES: C_3& operator=(C_3&& a) noexcept ;31};32 33C_3::C_3(C_3&& a) = default;34C_3& C_3::operator=(C_3&& a) = default;35 36template <class T>37struct C_4 {38 C_4(C_4<T>&&) {}39// CHECK-FIXES: C_4(C_4<T>&&) noexcept {}40 ~C_4() {}41 C_4& operator=(C_4&& a) = default;42};43 44template <class T>45struct C_5 {46 C_5(C_5<T>&&) {}47// CHECK-FIXES: C_5(C_5<T>&&) noexcept {}48 ~C_5() {}49 auto operator=(C_5&& a)->C_5<T> = default;50};51 52template <class T>53struct C_6 {54 C_6(C_6<T>&&) {}55// CHECK-FIXES: C_6(C_6<T>&&) noexcept {}56 ~C_6() {}57 auto operator=(C_6&& a)->C_6<T>;58// CHECK-FIXES: auto operator=(C_6&& a) noexcept ->C_6<T>;59};60 61template <class T>62auto C_6<T>::operator=(C_6<T>&& a) -> C_6<T> {}63// CHECK-FIXES: auto C_6<T>::operator=(C_6<T>&& a) noexcept -> C_6<T> {}64