diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-11-28 09:44:52 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-11-28 15:02:04 +0000 |
commit | a64775a0edd46980036b757041f0c065ed9f8d22 (patch) | |
tree | 8756b771d7dfd1eb705dd87a1522a959cc0c772a /libgcc/libgcc2.c | |
parent | be7ea145514eba69a3d53340da3f05f804e48833 (diff) | |
download | gcc-a64775a0edd46980036b757041f0c065ed9f8d22.zip gcc-a64775a0edd46980036b757041f0c065ed9f8d22.tar.gz gcc-a64775a0edd46980036b757041f0c065ed9f8d22.tar.bz2 |
libstdc++: Make 16-bit std::subtract_with_carry_engine work [PR107466]
This implements the proposed resolution of LWG 3809, so that
std::subtract_with_carry_engine can be used with a 16-bit result_type.
Currently this produces a narrowing error when instantiating the
std::linear_congruential_engine to create the initial state. It also
truncates the default_seed constant when passing it as a result_type
argument.
Change the type of the constant to uint_least32_t and pass 0u when the
default_seed should be used.
libstdc++-v3/ChangeLog:
PR libstdc++/107466
* include/bits/random.h (subtract_with_carry_engine): Use 32-bit
type for default seed. Use 0u as default argument for
subtract_with_carry_engine(result_type) constructor and
seed(result_type) member function.
* include/bits/random.tcc (subtract_with_carry_engine): Use
32-bit type for default seed and engine used for initial state.
* testsuite/26_numerics/random/subtract_with_carry_engine/cons/lwg3809.cc:
New test.
Diffstat (limited to 'libgcc/libgcc2.c')
0 files changed, 0 insertions, 0 deletions