From 63910131fff784fb652d3ad39f204afcfaf3c787 Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Tue, 4 Jan 2022 14:14:22 -0500 Subject: [PATCH] Try fixing MSVC 14 bug I don't know how to test this locally. --- test/unit_test/runtime/magnitude_test.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/unit_test/runtime/magnitude_test.cpp b/test/unit_test/runtime/magnitude_test.cpp index 5a866db2..afbaf62f 100644 --- a/test/unit_test/runtime/magnitude_test.cpp +++ b/test/unit_test/runtime/magnitude_test.cpp @@ -28,8 +28,19 @@ namespace units::mag { +// Convenience utility to create an integral base power. For unit tests only. +template +struct IntBasePower +{ + // This setup is more complicated than might appear necessary in the hopes of appeasing a + // (possibly spurious) MSVC 14 compiler error. + static constexpr std::intmax_t num = Num; + static constexpr std::intmax_t den = Den; + static constexpr ratio power = ratio{num, den}; + using type = base_power, power>; +}; template -using int_base_power = base_power, ratio{Num, Den}>; +using int_base_power = typename IntBasePower::type; TEST_CASE("Magnitude is invertible") {