[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:27:39 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:

Oh, this isn't testing `uniform_int_distribution`? Never mind then.

https://github.com/llvm/llvm-project/pull/93259


More information about the libcxx-commits mailing list