28
28
# include < locale>
29
29
#endif
30
30
31
+ #if __has_feature(pointer_field_protection)
32
+ constexpr bool pfp_disabled = false ;
33
+ #else
34
+ constexpr bool pfp_disabled = true ;
35
+ #endif
36
+
31
37
static_assert (std::__libcpp_is_trivially_relocatable<char >::value, " " );
32
38
static_assert (std::__libcpp_is_trivially_relocatable<int >::value, " " );
33
39
static_assert (std::__libcpp_is_trivially_relocatable<double >::value, " " );
@@ -70,8 +76,8 @@ static_assert(!std::__libcpp_is_trivially_relocatable<NonTrivialDestructor>::val
70
76
// ----------------------
71
77
72
78
// __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 , " " );
75
81
static_assert (!std::__libcpp_is_trivially_relocatable<std::__split_buffer<int , test_allocator<int > > >::value, " " );
76
82
77
83
// standard library types
@@ -84,7 +90,7 @@ static_assert(std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<
84
90
85
91
static_assert (std::__libcpp_is_trivially_relocatable<std::array<int , 1 > >::value, " " );
86
92
static_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 , " " );
88
94
89
95
// basic_string
90
96
#if !__has_feature(address_sanitizer) || !_LIBCPP_INSTRUMENTED_WITH_ASAN
@@ -99,17 +105,17 @@ struct NotTriviallyRelocatableCharTraits : constexpr_char_traits<T> {
99
105
};
100
106
101
107
static_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 ,
103
109
" " );
104
110
static_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 ,
106
112
" " );
107
113
static_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 ,
109
115
" " );
110
116
static_assert (
111
117
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 ,
113
119
" " );
114
120
static_assert (!std::__libcpp_is_trivially_relocatable<
115
121
std::basic_string<char , std::char_traits<char >, test_allocator<char > > >::value,
@@ -121,21 +127,21 @@ static_assert(
121
127
#endif
122
128
123
129
// 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 , " " );
126
132
static_assert (!std::__libcpp_is_trivially_relocatable<std::deque<int , test_allocator<int > > >::value, " " );
127
133
128
134
// exception_ptr
129
135
#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 , " " );
131
137
#endif
132
138
133
139
// expected
134
140
#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 );
139
145
140
146
static_assert (!std::__libcpp_is_trivially_relocatable<std::expected<int , NotTriviallyCopyable>>::value);
141
147
static_assert (!std::__libcpp_is_trivially_relocatable<std::expected<NotTriviallyCopyable, int >>::value);
@@ -145,42 +151,42 @@ static_assert(
145
151
146
152
// locale
147
153
#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 , " " );
149
155
#endif
150
156
151
157
// optional
152
158
#if TEST_STD_VER >= 17
153
159
static_assert (std::__libcpp_is_trivially_relocatable<std::optional<int >>::value, " " );
154
160
static_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 , " " );
156
162
#endif // TEST_STD_VER >= 17
157
163
158
164
// 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 , " " );
160
166
static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, int > >::value, " " );
161
167
static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<int , NotTriviallyCopyable> >::value, " " );
162
168
static_assert (!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
163
169
" " );
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 ,
165
171
" " );
166
172
167
173
// 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 , " " );
169
175
170
176
// tuple
171
177
#if TEST_STD_VER >= 11
172
178
static_assert (std::__libcpp_is_trivially_relocatable<std::tuple<> >::value, " " );
173
179
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 , " " );
175
181
static_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 , " " );
177
183
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 , " " );
179
185
static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, int > >::value, " " );
180
186
static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<int , NotTriviallyCopyable> >::value, " " );
181
187
static_assert (!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
182
188
" " );
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 ,
184
190
" " );
185
191
#endif // TEST_STD_VER >= 11
186
192
@@ -205,9 +211,9 @@ struct NotTriviallyRelocatablePointer {
205
211
void operator ()(T*);
206
212
};
207
213
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 , " " );
211
217
static_assert (!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int , NotTriviallyRelocatableDeleter> >::value,
212
218
" " );
213
219
static_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
221
227
#if TEST_STD_VER >= 17
222
228
static_assert (std::__libcpp_is_trivially_relocatable<std::variant<int > >::value, " " );
223
229
static_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 , " " );
225
231
226
232
static_assert (std::__libcpp_is_trivially_relocatable<std::variant<int , int > >::value, " " );
227
233
static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, int > >::value, " " );
228
234
static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<int , NotTriviallyCopyable> >::value, " " );
229
235
static_assert (!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
230
236
" " );
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 ,
232
238
" " );
233
239
#endif // TEST_STD_VER >= 17
234
240
235
241
// 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 , " " );
238
244
static_assert (!std::__libcpp_is_trivially_relocatable<std::vector<int , test_allocator<int > > >::value, " " );
239
245
240
246
// 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 , " " );
242
248
243
249
// TODO: Mark all the trivially relocatable STL types as such
0 commit comments