diff --git a/src/core/include/mp-units/quantity.h b/src/core/include/mp-units/quantity.h index ff1dc9b1..f8f7f6de 100644 --- a/src/core/include/mp-units/quantity.h +++ b/src/core/include/mp-units/quantity.h @@ -58,9 +58,12 @@ concept IntegralConversionFactor = Unit && Unit template concept QuantityConvertibleTo = Quantity && Quantity && implicitly_convertible(QFrom::quantity_spec, QTo::quantity_spec) && - convertible(QFrom::unit, QTo::unit) && requires(QFrom q) { detail::sudo_cast(q); } && + convertible(QFrom::unit, QTo::unit) && (treat_as_floating_point || - (!treat_as_floating_point && IntegralConversionFactor)); + (!treat_as_floating_point && IntegralConversionFactor)) && + // TODO consider providing constraints of sudo_cast here rather than testing if it can be called (its return type is + // deduced thus the function is evaluated here and may emit truncating conversion or other warnings) + requires(QFrom q) { detail::sudo_cast(q); }; template concept InvokeResultOf = std::regular_invocable && RepresentationOf, Ch>;