[libcxx-commits] [libcxx] [libc++] [test] Fix portability issues for MSVC (PR #93259)
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 28 12:24:38 PDT 2024
================
@@ -67,12 +68,14 @@ T basic_gcd(T m, T n) {
template <typename Input>
void do_fuzzy_tests() {
std::mt19937 gen(1938);
- std::uniform_int_distribution<Input> distrib;
+ using DistIntType = std::conditional_t<sizeof(Input) == 1, int, Input>; // See N4981 [rand.req.genl]/1.5
+ constexpr Input max_input = std::numeric_limits<Input>::max();
+ std::uniform_int_distribution<DistIntType> distrib(0, max_input);
----------------
cjdb wrote:
We need to keep `Input` as is. Your commit message says that the standard prohibits `int8_t`, but the wording is "undefined", not "ill-formed", meaning that we're allowed to provide `int8_t` as a documented extension, which libc++ does.
https://github.com/llvm/llvm-project/pull/93259
More information about the libcxx-commits
mailing list