2828# include < locale>
2929#endif
3030
31+ #if __has_feature(pointer_field_protection)
32+ constexpr bool pfp_disabled = false ;
33+ #else
34+ constexpr bool pfp_disabled = true ;
35+ #endif
36+
3137static_assert (std::__libcpp_is_trivially_relocatable<char >::value, " " );
3238static_assert (std::__libcpp_is_trivially_relocatable<int >::value, " " );
3339static_assert (std::__libcpp_is_trivially_relocatable<double >::value, " " );
@@ -70,8 +76,8 @@ static_assert(!std::__libcpp_is_trivially_relocatable<NonTrivialDestructor>::val
7076// ----------------------
7177
7278// __split_buffer
73- static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<int > >::value, " " );
74- static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<NotTriviallyCopyable> >::value, " " );
79+ static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<int > >::value == pfp_disabled , " " );
80+ static_assert (std::__libcpp_is_trivially_relocatable<std::__split_buffer<NotTriviallyCopyable> >::value == pfp_disabled , " " );
7581static_assert (!std::__libcpp_is_trivially_relocatable<std::__split_buffer<int , test_allocator<int > > >::value, " " );
7682
7783// standard library types
@@ -84,7 +90,7 @@ static_assert(std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<
8490
8591static_assert (std::__libcpp_is_trivially_relocatable<std::array<int , 1 > >::value, " " );
8692static_assert (!std::__libcpp_is_trivially_relocatable<std::array<NotTriviallyCopyable, 1 > >::value, " " );
87- static_assert (std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int >, 1 > >::value, " " );
93+ static_assert (std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int >, 1 > >::value == pfp_disabled , " " );
8894
8995// basic_string
9096#if !__has_feature(address_sanitizer) || !_LIBCPP_INSTRUMENTED_WITH_ASAN
@@ -99,17 +105,17 @@ struct NotTriviallyRelocatableCharTraits : constexpr_char_traits<T> {
99105};
100106
101107static_assert (std::__libcpp_is_trivially_relocatable<
102- std::basic_string<char , std::char_traits<char >, std::allocator<char > > >::value,
108+ std::basic_string<char , std::char_traits<char >, std::allocator<char > > >::value == pfp_disabled ,
103109 " " );
104110static_assert (std::__libcpp_is_trivially_relocatable<
105- std::basic_string<char , NotTriviallyRelocatableCharTraits<char >, std::allocator<char > > >::value,
111+ std::basic_string<char , NotTriviallyRelocatableCharTraits<char >, std::allocator<char > > >::value == pfp_disabled ,
106112 " " );
107113static_assert (std::__libcpp_is_trivially_relocatable<
108- std::basic_string<MyChar, constexpr_char_traits<MyChar>, std::allocator<MyChar> > >::value,
114+ std::basic_string<MyChar, constexpr_char_traits<MyChar>, std::allocator<MyChar> > >::value == pfp_disabled ,
109115 " " );
110116static_assert (
111117 std::__libcpp_is_trivially_relocatable<
112- std::basic_string<MyChar, NotTriviallyRelocatableCharTraits<MyChar>, std::allocator<MyChar> > >::value,
118+ std::basic_string<MyChar, NotTriviallyRelocatableCharTraits<MyChar>, std::allocator<MyChar> > >::value == pfp_disabled ,
113119 " " );
114120static_assert (!std::__libcpp_is_trivially_relocatable<
115121 std::basic_string<char , std::char_traits<char >, test_allocator<char > > >::value,
@@ -121,21 +127,21 @@ static_assert(
121127#endif
122128
123129// deque
124- static_assert (std::__libcpp_is_trivially_relocatable<std::deque<int > >::value, " " );
125- static_assert (std::__libcpp_is_trivially_relocatable<std::deque<NotTriviallyCopyable> >::value, " " );
130+ static_assert (std::__libcpp_is_trivially_relocatable<std::deque<int > >::value == pfp_disabled , " " );
131+ static_assert (std::__libcpp_is_trivially_relocatable<std::deque<NotTriviallyCopyable> >::value == pfp_disabled , " " );
126132static_assert (!std::__libcpp_is_trivially_relocatable<std::deque<int , test_allocator<int > > >::value, " " );
127133
128134// exception_ptr
129135#ifndef _LIBCPP_ABI_MICROSOFT // FIXME: Is this also the case on windows?
130- static_assert (std::__libcpp_is_trivially_relocatable<std::exception_ptr>::value, " " );
136+ static_assert (std::__libcpp_is_trivially_relocatable<std::exception_ptr>::value == pfp_disabled , " " );
131137#endif
132138
133139// expected
134140#if TEST_STD_VER >= 23
135- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , int > >::value);
136- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, int >>::value);
137- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , std::unique_ptr<int >>>::value);
138- static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, std::unique_ptr<int >>>::value);
141+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , int > >::value == pfp_disabled );
142+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, int >>::value == pfp_disabled );
143+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<int , std::unique_ptr<int >>>::value == pfp_disabled );
144+ static_assert (std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int >, std::unique_ptr<int >>>::value == pfp_disabled );
139145
140146static_assert (!std::__libcpp_is_trivially_relocatable<std::expected<int , NotTriviallyCopyable>>::value);
141147static_assert (!std::__libcpp_is_trivially_relocatable<std::expected<NotTriviallyCopyable, int >>::value);
@@ -145,42 +151,42 @@ static_assert(
145151
146152// locale
147153#ifndef TEST_HAS_NO_LOCALIZATION
148- static_assert (std::__libcpp_is_trivially_relocatable<std::locale>::value, " " );
154+ static_assert (std::__libcpp_is_trivially_relocatable<std::locale>::value == pfp_disabled , " " );
149155#endif
150156
151157// optional
152158#if TEST_STD_VER >= 17
153159static_assert (std::__libcpp_is_trivially_relocatable<std::optional<int >>::value, " " );
154160static_assert (!std::__libcpp_is_trivially_relocatable<std::optional<NotTriviallyCopyable>>::value, " " );
155- static_assert (std::__libcpp_is_trivially_relocatable<std::optional<std::unique_ptr<int >>>::value, " " );
161+ static_assert (std::__libcpp_is_trivially_relocatable<std::optional<std::unique_ptr<int >>>::value == pfp_disabled , " " );
156162#endif // TEST_STD_VER >= 17
157163
158164// pair
159- static_assert (std::__libcpp_is_trivially_relocatable<std::pair<int , int > >::value, " " );
165+ static_assert (std::__libcpp_is_trivially_relocatable<std::pair<int , int > >::value == pfp_disabled , " " );
160166static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, int > >::value, " " );
161167static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<int , NotTriviallyCopyable> >::value, " " );
162168static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
163169 " " );
164- static_assert (std::__libcpp_is_trivially_relocatable<std::pair<std::unique_ptr<int >, std::unique_ptr<int > > >::value,
170+ static_assert (std::__libcpp_is_trivially_relocatable<std::pair<std::unique_ptr<int >, std::unique_ptr<int > > >::value == pfp_disabled ,
165171 " " );
166172
167173// shared_ptr
168- static_assert (std::__libcpp_is_trivially_relocatable<std::shared_ptr<NotTriviallyCopyable> >::value, " " );
174+ static_assert (std::__libcpp_is_trivially_relocatable<std::shared_ptr<NotTriviallyCopyable> >::value == pfp_disabled , " " );
169175
170176// tuple
171177#if TEST_STD_VER >= 11
172178static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<> >::value, " " );
173179
174- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int > >::value, " " );
180+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int > >::value == pfp_disabled , " " );
175181static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable> >::value, " " );
176- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int > > >::value, " " );
182+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int > > >::value == pfp_disabled , " " );
177183
178- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int , int > >::value, " " );
184+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<int , int > >::value == pfp_disabled , " " );
179185static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, int > >::value, " " );
180186static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<int , NotTriviallyCopyable> >::value, " " );
181187static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
182188 " " );
183- static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int >, std::unique_ptr<int > > >::value,
189+ static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int >, std::unique_ptr<int > > >::value == pfp_disabled ,
184190 " " );
185191#endif // TEST_STD_VER >= 11
186192
@@ -205,9 +211,9 @@ struct NotTriviallyRelocatablePointer {
205211 void operator ()(T*);
206212};
207213
208- static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int > >::value, " " );
209- static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<NotTriviallyCopyable> >::value, " " );
210- static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int []> >::value, " " );
214+ static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int > >::value == pfp_disabled , " " );
215+ static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<NotTriviallyCopyable> >::value == pfp_disabled , " " );
216+ static_assert (std::__libcpp_is_trivially_relocatable<std::unique_ptr<int []> >::value == pfp_disabled , " " );
211217static_assert (!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int , NotTriviallyRelocatableDeleter> >::value,
212218 " " );
213219static_assert (!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int [], NotTriviallyRelocatableDeleter> >::value,
@@ -221,23 +227,23 @@ static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int[], Not
221227#if TEST_STD_VER >= 17
222228static_assert (std::__libcpp_is_trivially_relocatable<std::variant<int > >::value, " " );
223229static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable> >::value, " " );
224- static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int > > >::value, " " );
230+ static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int > > >::value == pfp_disabled , " " );
225231
226232static_assert (std::__libcpp_is_trivially_relocatable<std::variant<int , int > >::value, " " );
227233static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, int > >::value, " " );
228234static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<int , NotTriviallyCopyable> >::value, " " );
229235static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
230236 " " );
231- static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int >, std::unique_ptr<int > > >::value,
237+ static_assert (std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int >, std::unique_ptr<int > > >::value == pfp_disabled ,
232238 " " );
233239#endif // TEST_STD_VER >= 17
234240
235241// vector
236- static_assert (std::__libcpp_is_trivially_relocatable<std::vector<int > >::value, " " );
237- static_assert (std::__libcpp_is_trivially_relocatable<std::vector<NotTriviallyCopyable> >::value, " " );
242+ static_assert (std::__libcpp_is_trivially_relocatable<std::vector<int > >::value == pfp_disabled , " " );
243+ static_assert (std::__libcpp_is_trivially_relocatable<std::vector<NotTriviallyCopyable> >::value == pfp_disabled , " " );
238244static_assert (!std::__libcpp_is_trivially_relocatable<std::vector<int , test_allocator<int > > >::value, " " );
239245
240246// weak_ptr
241- static_assert (std::__libcpp_is_trivially_relocatable<std::weak_ptr<NotTriviallyCopyable> >::value, " " );
247+ static_assert (std::__libcpp_is_trivially_relocatable<std::weak_ptr<NotTriviallyCopyable> >::value == pfp_disabled , " " );
242248
243249// TODO: Mark all the trivially relocatable STL types as such
0 commit comments