diff options
author | Florin Iucha <florin@signbit.net> | 2019-11-28 00:30:23 +0300 |
---|---|---|
committer | jarro2783 <jarro.2783@gmail.com> | 2019-11-28 00:30:23 +0300 |
commit | 9457b3de3a9906db78b2a14e71da4dbdc39cfdbd (patch) | |
tree | 083e47bec921762143ad9003a9a6433fc4d720bc | |
parent | 073dd3e645fa0c853c3836f3788ca21c39af319d (diff) |
Fix -Wconversion warnings with GCC9 (#214)
-rw-r--r-- | include/cxxopts.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index e89c2e1..93c69d3 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<R>(t-1)-1; + return static_cast<R>(-static_cast<R>(t-1)-1); } template <typename R, typename T> @@ -611,7 +611,7 @@ namespace cxxopts throw_or_mimic<argument_incorrect_type>(text); } - US next = result * base + digit; + const US next = static_cast<US>(result * base + digit); if (result > next) { throw_or_mimic<argument_incorrect_type>(text); |