1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 #ifndef TEST_SUPPORT_TYPE_CLASSIFICATION_COPYABLE_H 9 #define TEST_SUPPORT_TYPE_CLASSIFICATION_COPYABLE_H 10 11 #include <memory> 12 13 #include "movable.h" 14 15 struct no_copy_constructor { 16 no_copy_constructor() = default; 17 18 no_copy_constructor(no_copy_constructor const&) = delete; 19 no_copy_constructor(no_copy_constructor&&) = default; 20 }; 21 22 struct no_copy_assignment { 23 no_copy_assignment() = default; 24 25 no_copy_assignment& operator=(no_copy_assignment const&) = delete; 26 no_copy_assignment& operator=(no_copy_assignment&&) = default; 27 }; 28 29 struct no_copy_assignment_mutable { 30 no_copy_assignment_mutable() = default; 31 32 no_copy_assignment_mutable& 33 operator=(no_copy_assignment_mutable const&) = default; 34 no_copy_assignment_mutable& operator=(no_copy_assignment_mutable&) = delete; 35 no_copy_assignment_mutable& operator=(no_copy_assignment_mutable&&) = default; 36 }; 37 38 struct derived_from_noncopyable : std::unique_ptr<int> {}; 39 40 struct has_noncopyable { 41 std::unique_ptr<int> x; 42 }; 43 44 struct const_copy_assignment { 45 const_copy_assignment() = default; 46 47 const_copy_assignment(const_copy_assignment const&); 48 const_copy_assignment(const_copy_assignment&&); 49 50 const_copy_assignment& operator=(const_copy_assignment&&); 51 const_copy_assignment const& operator=(const_copy_assignment const&) const; 52 }; 53 54 struct volatile_copy_assignment { 55 volatile_copy_assignment() = default; 56 57 volatile_copy_assignment(volatile_copy_assignment volatile&); 58 volatile_copy_assignment(volatile_copy_assignment volatile&&); 59 60 volatile_copy_assignment& operator=(volatile_copy_assignment&&); 61 volatile_copy_assignment volatile& 62 operator=(volatile_copy_assignment const&) volatile; 63 }; 64 65 struct cv_copy_assignment { 66 cv_copy_assignment() = default; 67 68 cv_copy_assignment(cv_copy_assignment const volatile&); 69 cv_copy_assignment(cv_copy_assignment const volatile&&); 70 71 cv_copy_assignment const volatile& 72 operator=(cv_copy_assignment const volatile&) const volatile; 73 cv_copy_assignment const volatile& 74 operator=(cv_copy_assignment const volatile&&) const volatile; 75 }; 76 77 #endif // TEST_SUPPORT_TYPE_CLASSIFICATION_COPYABLE_H 78