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 9 #ifndef TEST_SUPPORT_TYPE_CLASSIFICATION_COPYABLE_H 10 #define TEST_SUPPORT_TYPE_CLASSIFICATION_COPYABLE_H 11 12 #include <memory> 13 14 #include "movable.h" 15 16 struct no_copy_constructor { 17 no_copy_constructor() = default; 18 19 no_copy_constructor(no_copy_constructor const&) = delete; 20 no_copy_constructor(no_copy_constructor&&) = default; 21 }; 22 23 struct no_copy_assignment { 24 no_copy_assignment() = default; 25 26 no_copy_assignment& operator=(no_copy_assignment const&) = delete; 27 no_copy_assignment& operator=(no_copy_assignment&&) = default; 28 }; 29 30 struct no_copy_assignment_mutable { 31 no_copy_assignment_mutable() = default; 32 33 no_copy_assignment_mutable& 34 operator=(no_copy_assignment_mutable const&) = default; 35 no_copy_assignment_mutable& operator=(no_copy_assignment_mutable&) = delete; 36 no_copy_assignment_mutable& operator=(no_copy_assignment_mutable&&) = default; 37 }; 38 39 struct derived_from_noncopyable : std::unique_ptr<int> {}; 40 41 struct has_noncopyable { 42 std::unique_ptr<int> x; 43 }; 44 45 struct const_copy_assignment { 46 const_copy_assignment() = default; 47 48 const_copy_assignment(const_copy_assignment const&); 49 const_copy_assignment(const_copy_assignment&&); 50 51 const_copy_assignment& operator=(const_copy_assignment&&); 52 const_copy_assignment const& operator=(const_copy_assignment const&) const; 53 }; 54 55 struct volatile_copy_assignment { 56 volatile_copy_assignment() = default; 57 58 volatile_copy_assignment(volatile_copy_assignment volatile&); 59 volatile_copy_assignment(volatile_copy_assignment volatile&&); 60 61 volatile_copy_assignment& operator=(volatile_copy_assignment&&); 62 volatile_copy_assignment volatile& 63 operator=(volatile_copy_assignment const&) volatile; 64 }; 65 66 struct cv_copy_assignment { 67 cv_copy_assignment() = default; 68 69 cv_copy_assignment(cv_copy_assignment const volatile&); 70 cv_copy_assignment(cv_copy_assignment const volatile&&); 71 72 cv_copy_assignment const volatile& 73 operator=(cv_copy_assignment const volatile&) const volatile; 74 cv_copy_assignment const volatile& 75 operator=(cv_copy_assignment const volatile&&) const volatile; 76 }; 77 78 #endif // TEST_SUPPORT_TYPE_CLASSIFICATION_COPYABLE_H 79