diff --git a/src/core/include/mp_units/quantity_spec.h b/src/core/include/mp_units/quantity_spec.h index 15a3ea54..38073ca9 100644 --- a/src/core/include/mp_units/quantity_spec.h +++ b/src/core/include/mp_units/quantity_spec.h @@ -1389,7 +1389,7 @@ template } } -[[nodiscard]] consteval auto common_quantity_spec(QuantitySpec auto q) { return q; } +[[nodiscard]] consteval QuantitySpec auto common_quantity_spec(QuantitySpec auto q) { return q; } template [[nodiscard]] consteval QuantitySpec auto common_quantity_spec(Q1 q1, Q2 q2) @@ -1399,6 +1399,12 @@ template using QQ2 = std::remove_const_t; if constexpr (is_same_v) return q1; + else if constexpr (get_kind(q1) != get_kind(q2) && std::derived_from, + std::remove_const_t>) + return remove_kind(q1); + else if constexpr (get_kind(q1) != get_kind(q2) && std::derived_from, + std::remove_const_t>) + return remove_kind(q2); else if constexpr ((QuantityKindSpec && !QuantityKindSpec) || (detail::IntermediateDerivedQuantitySpec && detail::NamedQuantitySpec && implicitly_convertible(q1, q2)))