mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-05 13:14:29 +02:00
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:
@@ -306,12 +306,14 @@ constexpr auto operator*(magnitude<H1, T1...>, magnitude<H2, T2...>) {
|
|||||||
return magnitude<new_head>{} * partial_product;
|
return magnitude<new_head>{} * partial_product;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case for when H1 has the smaller base.
|
// 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...>{});
|
return magnitude<H1>{} * (magnitude<T1...>{} * magnitude<H2, T2...>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case for when H2 has the smaller base.
|
// 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...>{});
|
return magnitude<H2>{} * (magnitude<H1, T1...>{} * magnitude<T2...>{});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user