gcc/libstdc++-v3/testsuite
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
..
17_intro libstdc++: Workaround kernel-headers on s390x-linux 2024-04-22 18:00:06 +02:00
18_support Update copyright years. 2024-01-03 12:19:35 +01:00
19_diagnostics libstdc++: Build libbacktrace and 19_diagnostics/stacktrace with -funwind-tables [PR111641] 2024-06-04 09:10:24 +02:00
20_util libstdc++: Fix std::format for chrono::duration with unsigned rep [PR115668] 2024-06-28 10:44:00 +01:00
21_strings libstdc++: Fix tests that fail with -fno-char8_t 2024-04-08 17:44:18 +01:00
22_locale libstdc++: Implement C++26 std::text_encoding (P1885R12) [PR113318] 2024-01-17 11:49:11 +00:00
23_containers libstdc++: Fix std::to_array for trivial-ish types [PR115522] 2024-07-12 11:12:27 +01:00
24_iterators libstdc++-v3: drop GCC Runtime Library Exception from gen tests 2024-03-29 12:50:06 +01:00
25_algorithms libstdc++: Add nodiscard in <algorithm> 2024-03-14 16:58:15 +00:00
26_numerics libstdc++: Fix infinite loop in std::binomial_distribution [PR114359] 2024-03-19 15:59:44 +00:00
27_io libstdc++: Implement "Printing blank lines with println" for C++23 2024-04-17 17:33:10 +01:00
28_regex Update copyright years. 2024-01-03 12:19:35 +01:00
29_atomics libstdc++: Fix _Atomic(T) macro in <stdatomic.h> [PR115807] 2024-07-09 19:59:21 +01:00
30_threads libstdc++: Implement std::formatter<std:🧵:id> without <sstream> [PR115099] 2024-05-22 10:06:52 +01:00
abi Update copyright years. 2024-01-03 12:19:35 +01:00
backward Update copyright years. 2024-01-03 12:19:35 +01:00
config Update copyright years. 2024-01-03 12:19:35 +01:00
data
decimal Update copyright years. 2024-01-03 12:19:35 +01:00
experimental [libstdc++] [testsuite] defer to check_vect_support* [PR115454] 2024-06-27 08:14:34 -03:00
ext libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119] 2024-05-17 13:48:43 +01:00
lib libstdc++: Replace stacktrace effective target with feature test 2024-03-26 11:32:55 +00:00
libstdc++-abi Update copyright years. 2024-01-03 12:19:35 +01:00
libstdc++-dg Update copyright years. 2024-01-03 12:19:35 +01:00
libstdc++-prettyprinters libstdc++: Move test error_category to global scope 2024-03-13 21:25:14 +00:00
libstdc++-xmethods Update copyright years. 2024-01-03 12:19:35 +01:00
performance Update copyright years. 2024-01-03 12:19:35 +01:00
special_functions Update copyright years. 2024-01-03 12:19:35 +01:00
std libstdc++: Do not apply localized formatting to NaN and inf [PR114863] 2024-04-30 09:36:44 +01:00
tr1 libstdc++: Fix testsuite with -Wformat 2024-01-06 15:11:33 +00:00
tr2 Update copyright years. 2024-01-03 12:19:35 +01:00
util libstdc++: Update ABI test to disallow adding to released symbol versions 2024-05-14 10:50:19 +01:00
Makefile.am Update copyright years. 2024-01-03 12:19:35 +01:00
Makefile.in libstdc++: Add support for running tests with multiple -std options 2023-09-15 21:57:38 +01:00