diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index 3ca46da2..6226cdde 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -508,7 +508,7 @@ template } // namespace detail template - requires(!detail::QuantityKindSpec) && detail::SameQuantitySpec + requires(!detail::QuantityKindSpec) && (detail::get_kind_tree_root(Q{}) == Q{}) #if MP_UNITS_API_NO_CRTP struct kind_of_ final : Q::_base_type_ { #else diff --git a/src/core/include/mp-units/framework/quantity_spec_concepts.h b/src/core/include/mp-units/framework/quantity_spec_concepts.h index d59229bc..02caaa47 100644 --- a/src/core/include/mp-units/framework/quantity_spec_concepts.h +++ b/src/core/include/mp-units/framework/quantity_spec_concepts.h @@ -105,10 +105,6 @@ MP_UNITS_EXPORT template namespace detail { -template -concept SameQuantitySpec = QuantitySpec && - QuantitySpec && (QS1 == QS2); - template [[nodiscard]] consteval bool is_child_of(Child ch, Parent p); @@ -118,7 +114,7 @@ concept ChildQuantitySpecOf = (is_child_of(Child, Parent)); template concept NestedQuantityKindSpecOf = QuantitySpec && QuantitySpec && - (!SameQuantitySpec) && ChildQuantitySpecOf; + (get_kind(From) != get_kind(To)) && ChildQuantitySpecOf; template concept QuantitySpecConvertibleTo = diff --git a/src/core/include/mp-units/framework/unit_concepts.h b/src/core/include/mp-units/framework/unit_concepts.h index 08984c48..b9c96866 100644 --- a/src/core/include/mp-units/framework/unit_concepts.h +++ b/src/core/include/mp-units/framework/unit_concepts.h @@ -104,11 +104,11 @@ concept AssociatedUnit = Unit && detail::has_associated_quantity(U{}); * the provided quantity_spec type. */ MP_UNITS_EXPORT template -concept UnitOf = AssociatedUnit && QuantitySpec && - detail::QuantitySpecConvertibleTo && - // the below is to make `dimensionless[radian]` invalid - (detail::SameQuantitySpec || - !detail::NestedQuantityKindSpecOf); +concept UnitOf = + AssociatedUnit && QuantitySpec && + detail::QuantitySpecConvertibleTo && + // the below is to make `dimensionless[radian]` invalid + (get_kind(QS) == get_kind(get_quantity_spec(U{})) || !detail::NestedQuantityKindSpecOf); MP_UNITS_EXPORT template [[nodiscard]] consteval bool convertible(From from, To to);