From 64189254b681f69078b3bf72dcd7621446c9d290 Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Tue, 7 Jan 2020 16:38:28 +0300 Subject: [PATCH 1/2] variant self assignment test: suppress clang diagnostic --- src/unit_tests/variant/variant_assign_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/unit_tests/variant/variant_assign_test.cpp b/src/unit_tests/variant/variant_assign_test.cpp index 4f6509d7..f73df284 100644 --- a/src/unit_tests/variant/variant_assign_test.cpp +++ b/src/unit_tests/variant/variant_assign_test.cpp @@ -150,6 +150,11 @@ TEST_CASE("move assignment", "[variant]") TEST_CASE("variant::operator=() - self assignment", "[variant]") { +#if RTTR_COMPILER == RTTR_COMPILER_CLANG || RTTR_COMPILER == RTTR_COMPILER_APPLECLANG + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wself-assign" +#endif + SECTION("self assign - empty") { variant a; @@ -165,6 +170,10 @@ TEST_CASE("variant::operator=() - self assignment", "[variant]") CHECK(a.is_valid() == true); } + +#if RTTR_COMPILER == RTTR_COMPILER_CLANG || RTTR_COMPILER == RTTR_COMPILER_APPLECLANG + #pragma clang diagnostic pop +#endif } ///////////////////////////////////////////////////////////////////////////////////////// From 992df30caa14fe6bfcd2c38213314622e1e02aae Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Tue, 7 Jan 2020 16:46:50 +0300 Subject: [PATCH 2/2] fix clang warning 'implicit-int-float-conversion' --- src/rttr/detail/conversion/number_conversion.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rttr/detail/conversion/number_conversion.h b/src/rttr/detail/conversion/number_conversion.h index ac40c63b..24de7950 100644 --- a/src/rttr/detail/conversion/number_conversion.h +++ b/src/rttr/detail/conversion/number_conversion.h @@ -134,9 +134,9 @@ typename std::enable_if::value && bool>::type convert_to(const F& from, T& to) { - if (from > std::numeric_limits::max()) + if (from > static_cast(std::numeric_limits::max())) return false; // value too large - else if (from < -std::numeric_limits::max()) + else if (from < static_cast(-std::numeric_limits::max())) return false; // value to small to = static_cast(from); @@ -151,7 +151,7 @@ typename std::enable_if::value && bool>::type convert_to(const F& from, T& to) { - if (from < 0 || from > std::numeric_limits::max()) + if (from < 0 || from > static_cast(std::numeric_limits::max())) return false; // value too large to = static_cast(from);