gcc/libstdc++-v3/include/std
Jonathan Wakely 21c8708ba6 libstdc++: Fix std::to_array for trivial-ish types [PR115522]
Due to PR c++/85723 the std::is_trivial trait is true for types with a
deleted default constructor, so the use of std::is_trivial in
std::to_array is not sufficient to ensure the type can be trivially
default constructed then filled using memcpy.

I also forgot that a type with a deleted assignment operator can still
be trivial, so we also need to check that it's assignable because the
is_constant_evaluated() path can't use memcpy.

Replace the uses of std::is_trivial with std::is_trivially_copyable
(needed for memcpy), std::is_trivially_default_constructible (needed so
that the default construction is valid and does no work) and
std::is_copy_assignable (needed for the constant evaluation case).

libstdc++-v3/ChangeLog:

	PR libstdc++/115522
	* include/std/array (to_array): Workaround the fact that
	std::is_trivial is not sufficient to check that a type is
	trivially default constructible and assignable.
	* testsuite/23_containers/array/creation/115522.cc: New test.

(cherry picked from commit 510ce5eed69ee1bea9c2c696fe3b2301e16d1486)
2024-07-12 11:12:27 +01:00
..
algorithm Update copyright years. 2024-01-03 12:19:35 +01:00
any Update copyright years. 2024-01-03 12:19:35 +01:00
array libstdc++: Fix std::to_array for trivial-ish types [PR115522] 2024-07-12 11:12:27 +01:00
atomic libstdc++: Do not define lock-free atomic aliases if not fully lock-free [PR114103] 2024-03-07 20:55:25 +00:00
barrier Update copyright years. 2024-01-03 12:19:35 +01:00
bit Update copyright years. 2024-01-03 12:19:35 +01:00
bitset libstdc++: Remove redundant zeroing in std::bitset::operator>>= [PR113806] 2024-02-15 11:43:21 +00:00
charconv libstdc++: Consistently use noexcept, constexpr, nodiscard on bitmask ops 2024-02-28 11:27:46 +00:00
chrono libstdc++: Fix typo in Doxygen comment 2024-04-25 18:38:43 +01:00
codecvt Update copyright years. 2024-01-03 12:19:35 +01:00
complex Update copyright years. 2024-01-03 12:19:35 +01:00
concepts libstdc++: Implement P2165R4 changes to std::pair/tuple/etc [PR113309] 2024-02-01 14:59:46 -05:00
condition_variable Update copyright years. 2024-01-03 12:19:35 +01:00
coroutine Update copyright years. 2024-01-03 12:19:35 +01:00
deque Update copyright years. 2024-01-03 12:19:35 +01:00
execution Update copyright years. 2024-01-03 12:19:35 +01:00
expected libstdc++: Add std::span::at for C++26 (P2821R5) 2023-11-21 15:58:21 +00:00
filesystem Update copyright years. 2024-01-03 12:19:35 +01:00
format libstdc++: Do not apply localized formatting to NaN and inf [PR114863] 2024-04-30 09:36:44 +01:00
forward_list Update copyright years. 2024-01-03 12:19:35 +01:00
fstream Update copyright years. 2024-01-03 12:19:35 +01:00
functional libstdc++: Add std::reference_wrapper comparison operators for C++26 2024-04-15 19:26:09 +01:00
future libstdc++: Consistently use noexcept, constexpr, nodiscard on bitmask ops 2024-02-28 11:27:46 +00:00
generator libstdc++: Guard uses of is_pointer_interconvertible_v [PR114891] 2024-05-14 10:50:19 +01:00
iomanip Update copyright years. 2024-01-03 12:19:35 +01:00
ios Update copyright years. 2024-01-03 12:19:35 +01:00
iosfwd Update copyright years. 2024-01-03 12:19:35 +01:00
iostream Update copyright years. 2024-01-03 12:19:35 +01:00
istream Update copyright years. 2024-01-03 12:19:35 +01:00
iterator Update copyright years. 2024-01-03 12:19:35 +01:00
latch Update copyright years. 2024-01-03 12:19:35 +01:00
limits Update copyright years. 2024-01-03 12:19:35 +01:00
list Update copyright years. 2024-01-03 12:19:35 +01:00
locale Update copyright years. 2024-01-03 12:19:35 +01:00
map libstdc++: Implement P2165R4 changes to std::pair/tuple/etc [PR113309] 2024-02-01 14:59:46 -05:00
memory Update copyright years. 2024-01-03 12:19:35 +01:00
memory_resource Update copyright years. 2024-01-03 12:19:35 +01:00
mutex Update copyright years. 2024-01-03 12:19:35 +01:00
numbers Update copyright years. 2024-01-03 12:19:35 +01:00
numeric Update copyright years. 2024-01-03 12:19:35 +01:00
optional libstdc++: Reverse arguments in constraint for std::optional's <=> [PR104606] 2024-04-03 11:45:35 +01:00
ostream libstdc++: Implement "Printing blank lines with println" for C++23 2024-04-17 17:33:10 +01:00
print libstdc++: Implement "Printing blank lines with println" for C++23 2024-04-17 17:33:10 +01:00
queue Update copyright years. 2024-01-03 12:19:35 +01:00
random Update copyright years. 2024-01-03 12:19:35 +01:00
ranges libstdc++: Allow adjacent __maybe_present_t<false, ...> fields to overlap 2024-04-02 13:07:07 -04:00
ratio Update copyright years. 2024-01-03 12:19:35 +01:00
regex Update copyright years. 2024-01-03 12:19:35 +01:00
scoped_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
semaphore Update copyright years. 2024-01-03 12:19:35 +01:00
set Update copyright years. 2024-01-03 12:19:35 +01:00
shared_mutex Update copyright years. 2024-01-03 12:19:35 +01:00
source_location Update copyright years. 2024-01-03 12:19:35 +01:00
span libstdc++: Only define std::span::at for C++26 [PR115335] 2024-06-04 15:29:28 +01:00
spanstream libstdc++: Replace all manual FTM definitions and use 2023-08-16 15:16:25 +02:00
sstream Update copyright years. 2024-01-03 12:19:35 +01:00
stack Update copyright years. 2024-01-03 12:19:35 +01:00
stacktrace libstdc++: Guard use of sized deallocation [PR114940] 2024-05-28 10:19:44 +01:00
stdexcept Update copyright years. 2024-01-03 12:19:35 +01:00
stdfloat Update copyright years. 2024-01-03 12:19:35 +01:00
stop_token Update copyright years. 2024-01-03 12:19:35 +01:00
streambuf Update copyright years. 2024-01-03 12:19:35 +01:00
string Update copyright years. 2024-01-03 12:19:35 +01:00
string_view libstdc++: Use std::type_identity_t in <string_view> as per LWG 3950 [PR114400] 2024-03-23 11:07:57 +00:00
syncstream libstdc++: Remove noexcept from std::osyncstream::operator= 2024-02-02 10:18:04 +00:00
system_error Update copyright years. 2024-01-03 12:19:35 +01:00
text_encoding libstdc++: Implement C++26 std::text_encoding (P1885R12) [PR113318] 2024-01-17 11:49:11 +00:00
thread libstdc++: Implement std::formatter<std:🧵:id> without <sstream> [PR115099] 2024-05-22 10:06:52 +01:00
tuple libstdc++: Add missing std::tuple constructor [PR114147] 2024-03-04 20:24:58 +00:00
type_traits libstdc++: Replace std::result_of with __invoke_result_t [PR114394] 2024-03-22 22:37:57 +00:00
typeindex Update copyright years. 2024-01-03 12:19:35 +01:00
unordered_map libstdc++: Implement P2165R4 changes to std::pair/tuple/etc [PR113309] 2024-02-01 14:59:46 -05:00
unordered_set Update copyright years. 2024-01-03 12:19:35 +01:00
utility libstdc++: Implement P2165R4 changes to std::pair/tuple/etc [PR113309] 2024-02-01 14:59:46 -05:00
valarray libstdc++: Avoid aliasing violation in std::valarray [PR99117] 2024-02-15 11:43:21 +00:00
variant libstdc++: Add comment to #include in <variant> 2024-04-25 18:38:43 +01:00
vector Update copyright years. 2024-01-03 12:19:35 +01:00
version Update copyright years. 2024-01-03 12:19:35 +01:00