gcc/libstdc++-v3/testsuite
Jonathan Wakely c9dce3b15e libstdc++: Handle non-integral sizes in std::uninitialized_fill_n
The std::uninitialized_fill_n algorithm uses sd::fill_n for trivial
types, but that algorithm has a stronger requirement that the Size
parameter is convertible to an integral type. As the new test shows,
there are types which are valid for std::uninitialized_fill_n but which
produce a different result when converted to an integral type, or cannot
be converted at all. Only use the std::fill_n optimization when the Size
type is already an integral type.

The std::__uninitialized_default_n extension has the same problem, and
so does C++17's std::uninitialized_value_construct_n which uses it.

	* include/bits/stl_uninitialized.h (uninitialized_fill_n): Only
	use std::fill_n when the size is an integral type.
	(__uninitialized_default_n): Likewise.
	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/sizes.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/sizes.cc:
	New test.
2020-06-17 20:55:06 +01:00
..
17_intro
18_support libstdc++: Add new testcase for comparison category types 2020-05-27 13:14:17 +01:00
19_diagnostics
20_util libstdc++: Handle non-integral sizes in std::uninitialized_fill_n 2020-06-17 20:55:06 +01:00
21_strings libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20 2020-06-15 14:31:26 +01:00
22_locale
23_containers libstdc++: Make debug containers prefer copy ctor to base ctor (PR 90102) 2020-06-02 18:13:33 +01:00
24_iterators libstdc++: Define converting assignment operator for std::move_iterator 2020-06-09 22:16:24 +01:00
25_algorithms libstdc++: Fix some ranges algos optimizations [PR95578] 2020-06-10 17:37:53 -04:00
26_numerics libstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087) 2020-05-19 23:04:45 +01:00
27_io libstdc++: Fix istream::ignore discarding too many chars (PR 94749) 2020-06-11 18:41:37 +01:00
28_regex
29_atomics libstdc++: Enforce copyable/movable checks in std::atomic 2020-06-16 22:34:55 +01:00
30_threads
abi
backward
config
data
decimal
experimental libstdc++: Fix net::basic_socket::close(error_code&) 2020-05-21 00:59:55 +01:00
ext
lib
libstdc++-abi
libstdc++-dg
libstdc++-prettyprinters
libstdc++-xmethods
performance
special_functions
std libstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322) 2020-05-27 22:08:15 +01:00
tr1
tr2
util libstdc++: Make std::copy_n work with negative and non-integral sizes 2020-06-04 14:21:34 +01:00
Makefile.am libstdc++: Enable simple invocation of runtest in testsuite 2020-05-21 14:16:19 +01:00
Makefile.in libstdc++: Enable simple invocation of runtest in testsuite 2020-05-21 14:16:19 +01:00