From dc8843eeeb5111b3c99e08cf50790838902c3f46 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sat, 15 Feb 2025 10:39:36 +0100 Subject: [PATCH] refactor: MSVC bug is fixed so workaround is removed --- docs/getting_started/cpp_compiler_support.md | 15 +++++++-------- src/core/include/mp-units/framework/quantity.h | 8 ++------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/getting_started/cpp_compiler_support.md b/docs/getting_started/cpp_compiler_support.md index c5825684..913992f6 100644 --- a/docs/getting_started/cpp_compiler_support.md +++ b/docs/getting_started/cpp_compiler_support.md @@ -13,13 +13,13 @@ The table below provides the minimum compiler version required to compile the code using a specific C++ feature: -| C++ Feature | C++ version | gcc | clang | apple-clang | MSVC | -|-----------------------------------------------------------|:-----------:|:----:|:-----:|:-----------:|:-----------------------------------------:| -| **Minimum support** | 20 | 12 | 16 | 15 | 194 :bug:{ title="BEWARE of MSVC Bugs!" } | -| **`std::format`** | 20 | 13 | 17 | 16 | 194 | -| **C++ modules** | 20 | None | 17 | None | None | -| **`import std;`** | 23 | None | 18 | None | None | -| **Explicit `this` parameter** | 23 | 14 | 18 | None | None | +| C++ Feature | C++ version | gcc | clang | apple-clang | MSVC | +|-------------------------------|:-----------:|:----:|:-----:|:-----------:|:-----------------------------------------:| +| **Minimum support** | 20 | 12 | 16 | 15 | 194 :bug:{ title="BEWARE of MSVC Bugs!" } | +| **`std::format`** | 20 | 13 | 17 | 16 | 194 | +| **C++ modules** | 20 | None | 17 | None | None | +| **`import std;`** | 23 | None | 18 | None | None | +| **Explicit `this` parameter** | 23 | 14 | 18 | None | None | ??? note "MSVC bugs" @@ -30,7 +30,6 @@ C++ feature: Here is a list of the most important MSVC bugs: - - [Discrepancy in Behavior of operator*= and operator* for Multiplying int and double at compile time](https://developercommunity.visualstudio.com/t/Discrepancy-in-Behavior-of-operator-an/10732445) - [Syntax error when using non-type template parameters in templated class member function](https://developercommunity.visualstudio.com/t/Syntax-error-when-using-non-type-templat/10729428) - [Type always preferred over value when using qualified identifiers](https://developercommunity.visualstudio.com/t/Type-always-prefered-over-value-when-usi/10729382) diff --git a/src/core/include/mp-units/framework/quantity.h b/src/core/include/mp-units/framework/quantity.h index 792ab6e5..4b64a707 100644 --- a/src/core/include/mp-units/framework/quantity.h +++ b/src/core/include/mp-units/framework/quantity.h @@ -442,9 +442,7 @@ public: } friend constexpr decltype(auto) operator*=(Q&& lhs, const Value& val) { - // TODO use *= when compiler bug is resolved: - // https://developercommunity.visualstudio.com/t/Discrepancy-in-Behavior-of-operator-an/10732445 - lhs.numerical_value_is_an_implementation_detail_ = lhs.numerical_value_is_an_implementation_detail_ * val; + lhs.numerical_value_is_an_implementation_detail_ *= val; return std::forward(lhs); } @@ -465,9 +463,7 @@ public: friend constexpr decltype(auto) operator/=(Q&& lhs, const Value& val) { MP_UNITS_EXPECTS_DEBUG(val != representation_values::zero()); - // TODO use /= when compiler bug is resolved: - // https://developercommunity.visualstudio.com/t/Discrepancy-in-Behavior-of-operator-an/10732445 - lhs.numerical_value_is_an_implementation_detail_ = lhs.numerical_value_is_an_implementation_detail_ / val; + lhs.numerical_value_is_an_implementation_detail_ /= val; return std::forward(lhs); }