diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index c7ce60b..2f4c33e 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -551,7 +551,7 @@ namespace cxxopts // if we got to here, then `t` is a positive number that fits into // `R`. So to avoid MSVC C4146, we first cast it to `R`. // See https://github.com/jarro2783/cxxopts/issues/62 for more details. - return -static_cast(t-1)-1; + return static_cast(-static_cast(t-1)-1); } template @@ -611,7 +611,7 @@ namespace cxxopts throw_or_mimic(text); } - US next = result * base + digit; + const US next = static_cast(result * base + digit); if (result > next) { throw_or_mimic(text); diff --git a/test/options.cpp b/test/options.cpp index d110e01..d3d3c7a 100644 --- a/test/options.cpp +++ b/test/options.cpp @@ -9,7 +9,7 @@ class Argv { Argv(std::initializer_list args) : m_argv(new char*[args.size()]) - , m_argc(args.size()) + , m_argc(static_cast(args.size())) { int i = 0; auto iter = args.begin();