66//
77// ===----------------------------------------------------------------------===//
88
9+ // With PFP we return different values for __libcpp_is_trivially_relocatable.
10+ // UNSUPPORTED: pfp
11+
912#include < __type_traits/is_trivially_relocatable.h>
1013#include < array>
1114#include < deque>
2629# include < locale>
2730#endif
2831
29- #if defined(__POINTER_FIELD_PROTECTION__)
30- constexpr bool pfp_disabled = false ;
31- #else
32- constexpr bool pfp_disabled = true ;
33- #endif
34-
3532static_assert (std::__libcpp_is_trivially_relocatable<char >::value, " " );
3633static_assert (std::__libcpp_is_trivially_relocatable<int >::value, " " );
3734static_assert (std::__libcpp_is_trivially_relocatable<double >::value, " " );
@@ -74,8 +71,8 @@ static_assert(!std::__libcpp_is_trivially_relocatable<NonTrivialDestructor>::val
7471// ----------------------
7572
7673// __split_buffer
77- static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<int > >::value == pfp_disabled , " " );
78- static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<NotTriviallyCopyable> >::value == pfp_disabled , " " );
74+ static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<int > >::value, " " );
75+ static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<NotTriviallyCopyable> >::value, " " );
7976static_assert (!std::__libcpp_is_trivially_relocatable<std::__split_buffer<int , test_allocator<int > > >::value, " " );
8077
8178// standard library types
@@ -88,7 +85,7 @@ static_assert(std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<
8885
8986static_assert (std::__libcpp_is_trivially_relocatable<std::array<int , 1 > >::value, " " );
9087static_assert (!std::__libcpp_is_trivially_relocatable<std::array<NotTriviallyCopyable, 1 > >::value, " " );
91- static_assert (std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int >, 1 > >::value == pfp_disabled , " " );
88+ static_assert (std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int >, 1 > >::value, " " );
9289
9390// basic_string
9491#if !__has_feature(address_sanitizer) || !_LIBCPP_INSTRUMENTED_WITH_ASAN
@@ -103,17 +100,17 @@ struct NotTriviallyRelocatableCharTraits : constexpr_char_traits<T> {
103100};
104101
105102static_assert (std::__libcpp_is_trivially_relocatable<
106- std::basic_string<char , std::char_traits<char >, std::allocator<char > > >::value == pfp_disabled ,
103+ std::basic_string<char , std::char_traits<char >, std::allocator<char > > >::value,
107104 " " );
108105static_assert (std::__libcpp_is_trivially_relocatable<
109- std::basic_string<char , NotTriviallyRelocatableCharTraits<char >, std::allocator<char > > >::value == pfp_disabled ,
106+ std::basic_string<char , NotTriviallyRelocatableCharTraits<char >, std::allocator<char > > >::value,
110107 " " );
111108static_assert (std::__libcpp_is_trivially_relocatable<
112- std::basic_string<MyChar, constexpr_char_traits<MyChar>, std::allocator<MyChar> > >::value == pfp_disabled ,
109+ std::basic_string<MyChar, constexpr_char_traits<MyChar>, std::allocator<MyChar> > >::value,
113110 " " );
114111static_assert (
115112 std::__libcpp_is_trivially_relocatable<
116- std::basic_string<MyChar, NotTriviallyRelocatableCharTraits<MyChar>, std::allocator<MyChar> > >::value == pfp_disabled ,
113+ std::basic_string<MyChar, NotTriviallyRelocatableCharTraits<MyChar>, std::allocator<MyChar> > >::value,
117114 " " );
118115static_assert (!std::__libcpp_is_trivially_relocatable<
119116 std::basic_string<char , std::char_traits<char >, test_allocator<char > > >::value,
@@ -125,21 +122,21 @@ static_assert(
125122#endif
126123
127124// deque
128- static_assert (std::__libcpp_is_trivially_relocatable<std::deque<int > >::value == pfp_disabled , " " );
129- static_assert (std::__libcpp_is_trivially_relocatable<std::deque<NotTriviallyCopyable> >::value == pfp_disabled , " " );
125+ static_assert (std::__libcpp_is_trivially_relocatable<std::deque<int > >::value, " " );
126+ static_assert (std::__libcpp_is_trivially_relocatable<std::deque<NotTriviallyCopyable> >::value, " " );
130127static_assert (!std::__libcpp_is_trivially_relocatable<std::deque<int , test_allocator<int > > >::value, " " );
131128
132129// exception_ptr
133130#ifndef _LIBCPP_ABI_MICROSOFT // FIXME: Is this also the case on windows?
134- static_assert (std::__libcpp_is_trivially_relocatable<std::exception_ptr>::value == pfp_disabled , " " );
131+ static_assert (std::__libcpp_is_trivially_relocatable<std::exception_ptr>::value, " " );
135132#endif
136133
137134// expected
138135#if TEST_STD_VER >= 23
139- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , int > >::value == pfp_disabled );
140- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, int >>::value == pfp_disabled );
141- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , std::unique_ptr<int >>>::value == pfp_disabled );
142- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, std::unique_ptr<int >>>::value == pfp_disabled );
136+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , int > >::value);
137+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, int >>::value);
138+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , std::unique_ptr<int >>>::value);
139+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, std::unique_ptr<int >>>::value);
143140
144141static_assert (!std::__libcpp_is_trivially_relocatable<std::expected<int , NotTriviallyCopyable>>::value);
145142static_assert (!std::__libcpp_is_trivially_relocatable<std::expected<NotTriviallyCopyable, int >>::value);
@@ -149,42 +146,42 @@ static_assert(
149146
150147// locale
151148#ifndef TEST_HAS_NO_LOCALIZATION
152- static_assert (std::__libcpp_is_trivially_relocatable<std::locale>::value == pfp_disabled , " " );
149+ static_assert (std::__libcpp_is_trivially_relocatable<std::locale>::value, " " );
153150#endif
154151
155152// optional
156153#if TEST_STD_VER >= 17
157154static_assert (std::__libcpp_is_trivially_relocatable<std::optional<int >>::value, " " );
158155static_assert (!std::__libcpp_is_trivially_relocatable<std::optional<NotTriviallyCopyable>>::value, " " );
159- static_assert (std::__libcpp_is_trivially_relocatable<std::optional<std::unique_ptr<int >>>::value == pfp_disabled , " " );
156+ static_assert (std::__libcpp_is_trivially_relocatable<std::optional<std::unique_ptr<int >>>::value, " " );
160157#endif // TEST_STD_VER >= 17
161158
162159// pair
163- static_assert (std::__libcpp_is_trivially_relocatable<std::pair<int , int > >::value == pfp_disabled , " " );
160+ static_assert (std::__libcpp_is_trivially_relocatable<std::pair<int , int > >::value, " " );
164161static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, int > >::value, " " );
165162static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<int , NotTriviallyCopyable> >::value, " " );
166163static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
167164 " " );
168- static_assert (std::__libcpp_is_trivially_relocatable<std::pair<std::unique_ptr<int >, std::unique_ptr<int > > >::value == pfp_disabled ,
165+ static_assert (std::__libcpp_is_trivially_relocatable<std::pair<std::unique_ptr<int >, std::unique_ptr<int > > >::value,
169166 " " );
170167
171168// shared_ptr
172- static_assert (std::__libcpp_is_trivially_relocatable<std::shared_ptr<NotTriviallyCopyable> >::value == pfp_disabled , " " );
169+ static_assert (std::__libcpp_is_trivially_relocatable<std::shared_ptr<NotTriviallyCopyable> >::value, " " );
173170
174171// tuple
175172#if TEST_STD_VER >= 11
176173static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<> >::value, " " );
177174
178- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int > >::value == pfp_disabled , " " );
175+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int > >::value, " " );
179176static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable> >::value, " " );
180- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int > > >::value == pfp_disabled , " " );
177+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int > > >::value, " " );
181178
182- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int , int > >::value == pfp_disabled , " " );
179+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int , int > >::value, " " );
183180static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, int > >::value, " " );
184181static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<int , NotTriviallyCopyable> >::value, " " );
185182static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
186183 " " );
187- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int >, std::unique_ptr<int > > >::value == pfp_disabled ,
184+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int >, std::unique_ptr<int > > >::value,
188185 " " );
189186#endif // TEST_STD_VER >= 11
190187
@@ -209,9 +206,9 @@ struct NotTriviallyRelocatablePointer {
209206 void operator ()(T*);
210207};
211208
212- static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int > >::value == pfp_disabled , " " );
213- static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<NotTriviallyCopyable> >::value == pfp_disabled , " " );
214- static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int []> >::value == pfp_disabled , " " );
209+ static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int > >::value, " " );
210+ static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<NotTriviallyCopyable> >::value, " " );
211+ static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int []> >::value, " " );
215212static_assert (!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int , NotTriviallyRelocatableDeleter> >::value,
216213 " " );
217214static_assert (!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int [], NotTriviallyRelocatableDeleter> >::value,
@@ -225,23 +222,23 @@ static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int[], Not
225222#if TEST_STD_VER >= 17
226223static_assert (std::__libcpp_is_trivially_relocatable<std::variant<int > >::value, " " );
227224static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable> >::value, " " );
228- static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int > > >::value == pfp_disabled , " " );
225+ static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int > > >::value, " " );
229226
230227static_assert (std::__libcpp_is_trivially_relocatable<std::variant<int , int > >::value, " " );
231228static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, int > >::value, " " );
232229static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<int , NotTriviallyCopyable> >::value, " " );
233230static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
234231 " " );
235- static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int >, std::unique_ptr<int > > >::value == pfp_disabled ,
232+ static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int >, std::unique_ptr<int > > >::value,
236233 " " );
237234#endif // TEST_STD_VER >= 17
238235
239236// vector
240- static_assert (std::__libcpp_is_trivially_relocatable<std::vector<int > >::value == pfp_disabled , " " );
241- static_assert (std::__libcpp_is_trivially_relocatable<std::vector<NotTriviallyCopyable> >::value == pfp_disabled , " " );
237+ static_assert (std::__libcpp_is_trivially_relocatable<std::vector<int > >::value, " " );
238+ static_assert (std::__libcpp_is_trivially_relocatable<std::vector<NotTriviallyCopyable> >::value, " " );
242239static_assert (!std::__libcpp_is_trivially_relocatable<std::vector<int , test_allocator<int > > >::value, " " );
243240
244241// weak_ptr
245- static_assert (std::__libcpp_is_trivially_relocatable<std::weak_ptr<NotTriviallyCopyable> >::value == pfp_disabled , " " );
242+ static_assert (std::__libcpp_is_trivially_relocatable<std::weak_ptr<NotTriviallyCopyable> >::value, " " );
246243
247244// TODO: Mark all the trivially relocatable STL types as such
0 commit comments