[libcxx-commits] [libcxx] [libc++] [test] Fix portability issues	for MSVC (PR #93259)
    Stephan T. Lavavej via libcxx-commits 
    libcxx-commits at lists.llvm.org
       
    Tue May 28 12:26:18 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);
----------------
StephanTLavavej wrote:
But this is the `libcxx/test/std` subdirectory, which is portable. If you want to test a libc++ extension, that should be guarded with the libc++ macro (which I would be fine with).
https://github.com/llvm/llvm-project/pull/93259
    
    
More information about the libcxx-commits
mailing list