CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion (#1817)

* CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion

* test/ranges-test.cc: changed type of integer literals to unsigned

* test/format-test.cc: fixed implicit conversion changes signedness warning in clang

Co-authored-by: Martin Wührer <martin.wuehrer@artech.at>
This commit is contained in:
medithe 2020-08-14 22:58:20 +02:00 committed by GitHub
parent 76e97dc4df
commit f9f02df719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View File

@ -130,7 +130,7 @@ endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion
-Wno-sign-conversion -Wdeprecated -Wweak-vtables)
-Wdeprecated -Wweak-vtables)
check_cxx_compiler_flag(-Wzero-as-null-pointer-constant HAS_NULLPTR_WARNING)
if (HAS_NULLPTR_WARNING)
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}

View File

@ -1828,14 +1828,18 @@ class mock_arg_formatter
}
template <typename T>
typename std::enable_if<fmt::detail::is_integral<T>::value, iterator>::type
typename std::enable_if<fmt::detail::is_integral<T>::value &&
fmt::detail::is_signed<T>::value,
iterator>::type
operator()(T value) {
call(value);
return base::operator()(value);
}
template <typename T>
typename std::enable_if<!fmt::detail::is_integral<T>::value, iterator>::type
typename std::enable_if<!(fmt::detail::is_integral<T>::value &&
fmt::detail::is_signed<T>::value),
iterator>::type
operator()(T value) {
return base::operator()(value);
}

View File

@ -175,15 +175,17 @@ template <typename T> class non_const_only_range {
};
TEST(RangesTest, JoinRange) {
non_const_only_range<int> x(3, 0);
non_const_only_range<int> x(3u, 0);
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(x, ",")));
EXPECT_EQ("0,0,0",
fmt::format("{}", fmt::join(non_const_only_range<int>(3, 0), ",")));
EXPECT_EQ(
"0,0,0",
fmt::format("{}", fmt::join(non_const_only_range<int>(3u, 0), ",")));
std::vector<int> y(3, 0);
std::vector<int> y(3u, 0);
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(y, ",")));
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(std::vector<int>(3, 0), ",")));
EXPECT_EQ("0,0,0",
fmt::format("{}", fmt::join(std::vector<int>(3u, 0), ",")));
const std::vector<int> z(3, 0);
const std::vector<int> z(3u, 0);
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(z, ",")));
}