Try fixing "unreachable code" warning on MSVC 14.2

This doesn't show up on any other compiler, including MSVC 14.3, so I
think it's just a compiler bug.  Cursory googling suggests perhaps that
some older versions of MSVC have immature support for `if constexpr`.
This commit is contained in:
Chip Hogg
2022-01-12 09:47:40 -05:00
parent d554fb28cc
commit fb602a4497

View File

@@ -306,12 +306,14 @@ constexpr auto operator*(magnitude<H1, T1...>, magnitude<H2, T2...>) {
return magnitude<new_head>{} * partial_product;
}
}
// Case for when H1 has the smaller base.
else if constexpr(H1.get_base() < H2.get_base()){
if constexpr(H1.get_base() < H2.get_base()){
return magnitude<H1>{} * (magnitude<T1...>{} * magnitude<H2, T2...>{});
}
// Case for when H2 has the smaller base.
else {
if constexpr(H1.get_base() > H2.get_base()){
return magnitude<H2>{} * (magnitude<H1, T1...>{} * magnitude<T2...>{});
}
}