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.