diff --git a/src/core/include/mp-units/quantity_spec.h b/src/core/include/mp-units/quantity_spec.h index 556b8cd2..ae958d04 100644 --- a/src/core/include/mp-units/quantity_spec.h +++ b/src/core/include/mp-units/quantity_spec.h @@ -411,7 +411,11 @@ struct quantity_spec : quantity_spec { */ template struct derived_quantity_spec : +#ifdef __cpp_explicit_this_parameter + detail::quantity_spec_interface, +#else detail::quantity_spec_interface>, +#endif detail::expr_fractions { using _base_ = detail::expr_fractions; @@ -443,9 +447,9 @@ concept QuantitySpecWithNoSpecifiers = detail::NamedQuantitySpec || detail::I } // namespace detail #ifdef __cpp_explicit_this_parameter -template - requires(get_kind(Q) == Q) -struct kind_of_ : Q { +template + requires(detail::QuantitySpecWithNoSpecifiers>) && (get_kind(Q) == Q) +struct kind_of_ : std::remove_const_t { static constexpr auto _quantity_spec_ = Q; }; #else @@ -1416,12 +1420,9 @@ template template [[nodiscard]] consteval auto remove_kind(Q q) { - if constexpr (detail::QuantityKindSpec) { - if constexpr (requires { Q::_parent_; }) - return Q::_parent_; - else - return Q::_equation_; - } else + if constexpr (detail::QuantityKindSpec) + return Q::_quantity_spec_; + else return q; }