diff --git a/src/core/include/mp-units/bits/magnitude.h b/src/core/include/mp-units/bits/magnitude.h index c4d23b31..ae12b527 100644 --- a/src/core/include/mp-units/bits/magnitude.h +++ b/src/core/include/mp-units/bits/magnitude.h @@ -136,9 +136,27 @@ inline constexpr bool is_named_magnitude = Magnitude && !detail::is_specializ } +#if UNITS_COMP_CLANG + +template +struct mag_value { + T value; +}; + +template +mag_value(T) -> mag_value; + +template +concept PowerVBase = + one_of || is_specialization_of || detail::is_named_magnitude; + +#else + template concept PowerVBase = one_of || detail::is_named_magnitude; +#endif + // TODO Unify with `power` if UTPs (P1985) are accepted by the Committee template requires(detail::valid_ratio && !detail::ratio_one) @@ -166,8 +184,11 @@ namespace detail { template [[nodiscard]] consteval auto get_base(Element element) { - if constexpr (detail::is_specialization_of_power_v) - return Element::base; + if constexpr (detail::is_specialization_of_power_v) return Element::base; +#if UNITS_COMP_CLANG + else if constexpr (is_specialization_of) + return element.value; +#endif else return element; } @@ -497,13 +518,21 @@ constexpr T get_value(const magnitude&) return result; } - /** * @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number. */ +#if UNITS_COMP_CLANG + +inline constexpr struct mag_pi : magnitude}> { +} mag_pi; + +#else + inline constexpr struct mag_pi : magnitude> { } mag_pi; +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Magnitude equality implementation.