Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jarro2783/cxxopts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorin Iucha <florin@signbit.net>2019-11-28 00:30:23 +0300
committerjarro2783 <jarro.2783@gmail.com>2019-11-28 00:30:23 +0300
commit9457b3de3a9906db78b2a14e71da4dbdc39cfdbd (patch)
tree083e47bec921762143ad9003a9a6433fc4d720bc
parent073dd3e645fa0c853c3836f3788ca21c39af319d (diff)
Fix -Wconversion warnings with GCC9 (#214)
-rw-r--r--include/cxxopts.hpp4
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);