diff --git a/src/core/include/mp-units/bits/hacks.h b/src/core/include/mp-units/bits/hacks.h index 3b8c9a89..f9e98f24 100644 --- a/src/core/include/mp-units/bits/hacks.h +++ b/src/core/include/mp-units/bits/hacks.h @@ -150,5 +150,9 @@ MP_UNITS_DIAGNOSTIC_POP #define MP_UNITS_API_NO_CRTP 1 +#endif + +#if defined(__clang__) && defined(__apple_build_version__) && __apple_build_version__ < 16000026 +#define MP_UNITS_XCODE15_HACKS #endif // NOLINTEND(bugprone-reserved-identifier, cppcoreguidelines-macro-usage) diff --git a/src/core/include/mp-units/framework/representation_concepts.h b/src/core/include/mp-units/framework/representation_concepts.h index ff99bd96..58b806eb 100644 --- a/src/core/include/mp-units/framework/representation_concepts.h +++ b/src/core/include/mp-units/framework/representation_concepts.h @@ -88,7 +88,7 @@ concept Scalar = (!disable_scalar) && { a + b } -> std::common_with; { a - b } -> std::common_with; } && ScalableWith -#if MP_UNITS_COMP_GCC != 12 +#if MP_UNITS_COMP_GCC != 12 && !defined(MP_UNITS_XCODE15_HACKS) && WeaklyRegular #endif ; @@ -177,19 +177,23 @@ constexpr bool disable_complex = false; namespace detail { template -concept Complex = (!disable_complex) && requires(const T a, const T b, const T& c) { - { -a } -> std::common_with; - { a + b } -> std::common_with; - { a - b } -> std::common_with; - { a* b } -> std::common_with; - { a / b } -> std::common_with; - ::mp_units::real(a); - ::mp_units::imag(a); - ::mp_units::modulus(a); - requires ScalableWith; - requires std::constructible_from; -} && WeaklyRegular; - +concept Complex = (!disable_complex) && + requires(const T a, const T b, const T& c) { + { -a } -> std::common_with; + { a + b } -> std::common_with; + { a - b } -> std::common_with; + { a* b } -> std::common_with; + { a / b } -> std::common_with; + ::mp_units::real(a); + ::mp_units::imag(a); + ::mp_units::modulus(a); + requires ScalableWith; + requires std::constructible_from; + } +#ifndef MP_UNITS_XCODE15_HACKS + && WeaklyRegular +#endif + ; namespace magnitude_impl { void magnitude() = delete; // poison pill @@ -238,19 +242,24 @@ constexpr bool disable_vector = false; namespace detail { template -concept Vector = (!disable_vector) && requires(const T a, const T b) { - { -a } -> std::common_with; - { a + b } -> std::common_with; - { a - b } -> std::common_with; - ::mp_units::magnitude(a); - requires ScalableWith; - // TODO should we also check for the below (e.g., when `size() > 1` or `2`) - // ::mp_units::zero_vector(); - // ::mp_units::unit_vector(a); - // ::mp_units::scalar_product(a, b); - // ::mp_units::vector_product(a, b); - // ::mp_units::tensor_product(a, b); -} && WeaklyRegular; +concept Vector = (!disable_vector) && + requires(const T a, const T b) { + { -a } -> std::common_with; + { a + b } -> std::common_with; + { a - b } -> std::common_with; + ::mp_units::magnitude(a); + requires ScalableWith; + // TODO should we also check for the below (e.g., when `size() > 1` or `2`) + // ::mp_units::zero_vector(); + // ::mp_units::unit_vector(a); + // ::mp_units::scalar_product(a, b); + // ::mp_units::vector_product(a, b); + // ::mp_units::tensor_product(a, b); + } +#ifndef MP_UNITS_XCODE15_HACKS + && WeaklyRegular +#endif + ; } // namespace detail