From 296955c437f29addaf6c5cbfeb47a606b96a5ab1 Mon Sep 17 00:00:00 2001 From: Sebastian Grottel Date: Sun, 15 Oct 2017 18:30:40 +0200 Subject: [PATCH] `RandomNumberGenerator::result_type` should be unsigned (#1050) `result_type` must be unsigned: http://en.cppreference.com/w/cpp/concept/UniformRandomBitGenerator Using a signed type causes an infinite loop working with MS Visual Studio 2017, targetting: v140, WindowsTargetPlatformVersion 10.0.15063.0, Debug, x64 --- include/internal/catch_test_case_registry_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index 316c6c2c..879884d6 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -22,7 +22,7 @@ namespace Catch { struct RandomNumberGenerator { - typedef std::ptrdiff_t result_type; + typedef unsigned int result_type; result_type operator()( result_type n ) const { return std::rand() % n; }