Skip to content

Commit

Permalink
close #236 (Integer overflow warning detected by clang++)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele77 committed Apr 3, 2024
1 parent ee14ce0 commit af87753
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions examples/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class PluginContainer
{
auto p = PluginRegistry::Instance().Create(plugin, menu);
if (p)
plugins.push_back(move(p));
plugins.push_back(std::move(p));
}
void Unload(const string& plugin)
{
Expand Down Expand Up @@ -187,7 +187,7 @@ class Arithmetic : public RegisteredPlugin<Arithmetic, ArithmeticName>
},
"Print the result of a subtraction" );

menuHandler = menu->Insert(move(subMenu));
menuHandler = menu->Insert(std::move(subMenu));
}
~Arithmetic() override
{
Expand Down Expand Up @@ -237,7 +237,7 @@ class Strings : public RegisteredPlugin<Strings, StringsName>
out << "\n";
},
"Alphabetically sort a list of words" );
menuHandler = menu->Insert(move(subMenu));
menuHandler = menu->Insert(std::move(subMenu));
}
~Strings() override
{
Expand Down
2 changes: 1 addition & 1 deletion include/cli/detail/fromstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ inline T signed_from_string(std::string s)
{
s = s.substr(1);
const U val = unsigned_digits_from_string<U>(s);
const auto min = std::numeric_limits<T>::min(); // this to avoid overflow warnings
auto min = std::numeric_limits<T>::min(); // this to avoid overflow warnings. Please NOTE: const auto produces warning!
if ( val > static_cast<U>( - min ) )
throw bad_conversion();
return (- static_cast<T>(val));
Expand Down

0 comments on commit af87753

Please sign in to comment.