[all-commits] [llvm/llvm-project] a3255f: [libc++] Explicitly reject `uniform_int_distributi...
Quuxplusone via All-commits
all-commits at lists.llvm.org
Mon Feb 28 11:59:27 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a3255f219a861fd91423def693e1b3ab3e012bec
https://github.com/llvm/llvm-project/commit/a3255f219a861fd91423def693e1b3ab3e012bec
Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
Date: 2022-02-28 (Mon, 28 Feb 2022)
Changed paths:
M libcxx/docs/ReleaseNotes.rst
M libcxx/include/CMakeLists.txt
M libcxx/include/__random/binomial_distribution.h
M libcxx/include/__random/discrete_distribution.h
M libcxx/include/__random/geometric_distribution.h
A libcxx/include/__random/is_valid.h
M libcxx/include/__random/negative_binomial_distribution.h
M libcxx/include/__random/poisson_distribution.h
M libcxx/include/__random/uniform_int_distribution.h
M libcxx/include/module.modulemap
M libcxx/include/random
A libcxx/test/libcxx/diagnostics/detail.headers/random/is_valid.header.verify.cpp
A libcxx/test/libcxx/diagnostics/detail.headers/random/is_valid.module.verify.cpp
A libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_int_type.verify.cpp
Log Message:
-----------
[libc++] Explicitly reject `uniform_int_distribution<bool>` and `<char>`.
`uniform_int_distribution<T>` is UB unless `T` is one of the non-character,
non-boolean integer types (`short` or larger). However, libc++ has never
enforced this. D114129 accidentally made `uniform_int_distribution<bool>`
into an error. Make it now *intentionally* an error; and likewise for the
character types and all user-defined class and enum types; but permit
`__[u]int128_t` to continue working.
Apply the same static_assert to all the integer distributions.
Differential Revision: https://reviews.llvm.org/D114920
More information about the All-commits
mailing list