fix: MSVC compilation fixed

This commit is contained in:
Mateusz Pusz
2021-01-06 19:06:09 +01:00
parent 3ce9a5ba67
commit ba37c37abd
2 changed files with 4 additions and 2 deletions

View File

@@ -52,4 +52,4 @@ target_link_libraries(unit_tests_static
mp::units
)
set_source_files_properties(quantity_test.cpp PROPERTIES COMPILE_FLAGS -Wno-conversion)
set_source_files_properties(quantity_test.cpp PROPERTIES COMPILE_OPTIONS $<IF:$<CXX_COMPILER_ID:MSVC>,/wd4244,-Wno-conversion>)

View File

@@ -283,10 +283,12 @@ static_assert((2.5_q_m *= 3).count() == 7.5);
static_assert((7.5_q_m /= 3).count() == 2.5);
static_assert((3500_q_m %= 1_q_km).count() == 500);
// next two lines trigger the gcc 'Wconversion' warning
#ifndef COMP_MSVC // TODO ICE (https://developercommunity2.visualstudio.com/t/ICE-on-a-constexpr-operator-in-mp-unit/1302907)
// next two lines trigger conversions warnings
// (warning disabled in CMake for this file)
static_assert((22_q_m *= 33.33).count() == 733);
static_assert((22_q_m /= 3.33).count() == 6);
#endif
template<typename Metre>
concept invalid_compound_assignments = requires() {