diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index 8235ba8..c0e13dd 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -610,9 +610,9 @@ public: return get() == rhs; } else { auto lhs = get(); - return std::equal( - std::begin(lhs), std::end(lhs), std::begin(rhs), std::end(rhs), - [](const auto &lhs, const auto &rhs) { return lhs == rhs; }); + return std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs), + std::end(rhs), + [](const auto &a, const auto &b) { return a == b; }); } } @@ -730,10 +730,10 @@ private: }; // precondition: we have consumed or will consume at least one digit - auto consume_digits = [=](std::string_view s) { + auto consume_digits = [=](std::string_view sd) { // NOLINTNEXTLINE(readability-qualified-auto) - auto it = std::find_if_not(std::begin(s), std::end(s), is_digit); - return s.substr(static_cast(it - std::begin(s))); + auto it = std::find_if_not(std::begin(sd), std::end(sd), is_digit); + return sd.substr(static_cast(it - std::begin(sd))); }; switch (lookahead(s)) { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dd7aecc..b61040f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -10,7 +10,7 @@ if(MSVC) endif() elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -Wsign-conversion") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -Wsign-conversion -Wshadow -Wconversion") endif() if(NOT CMAKE_BUILD_TYPE) diff --git a/test/test_parse_args.cpp b/test/test_parse_args.cpp index 76e7f0e..7a38abf 100644 --- a/test/test_parse_args.cpp +++ b/test/test_parse_args.cpp @@ -200,8 +200,8 @@ TEST_CASE("Parse a vector of string arguments and construct objects" * class Foo { public: - Foo(const std::string &value) : value(value) {} - std::string value; + Foo(const std::string &value) : m_value(value) {} + std::string m_value; }; argparse::ArgumentParser program("test"); @@ -211,9 +211,9 @@ TEST_CASE("Parse a vector of string arguments and construct objects" * program.parse_args({"test", "--vector", "abc", "def", "ghi", "jkl", "mno"}); auto vector = program.get>("--vector"); REQUIRE(vector.size() == 5); - REQUIRE(vector[0].value == Foo("abc").value); - REQUIRE(vector[1].value == Foo("def").value); - REQUIRE(vector[2].value == Foo("ghi").value); - REQUIRE(vector[3].value == Foo("jkl").value); - REQUIRE(vector[4].value == Foo("mno").value); + REQUIRE(vector[0].m_value == Foo("abc").m_value); + REQUIRE(vector[1].m_value == Foo("def").m_value); + REQUIRE(vector[2].m_value == Foo("ghi").m_value); + REQUIRE(vector[3].m_value == Foo("jkl").m_value); + REQUIRE(vector[4].m_value == Foo("mno").m_value); } diff --git a/test/test_repr.cpp b/test/test_repr.cpp index dc7d1c7..c09c3ac 100644 --- a/test/test_repr.cpp +++ b/test/test_repr.cpp @@ -23,7 +23,7 @@ TEST_CASE_TEMPLATE("Test built-in float types representation" * test_suite("repr"), T, float, double, long double) { std::stringstream ss; - T v = 0.3333333333; + T v = static_cast(0.3333333333); ss << v; REQUIRE(argparse::details::repr(v) == ss.str()); }