Skip to content

Commit 40f7f70

Browse files
authored
Merge pull request #697 from rothmichaels/bugfix/xcode-build
Fix Xcode long build times and/or crashes
2 parents e0ce43c + dc47ac3 commit 40f7f70

File tree

2 files changed

+43
-24
lines changed

2 files changed

+43
-24
lines changed

.github/generate-job-matrix.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ def make_msvc_config(release: str, version: int) -> Configuration:
9797
# arm64 runners are expensive; only consider one version
9898
if ver == 18 or platform != "arm64"
9999
]
100-
# TODO uncomment the below when apple-clang-15 crash is fixed
101-
# + [
102-
# make_apple_clang_config("macos-13", ver, std_format_support=False)
103-
# for ver in ["15.2"]
104-
# ]
100+
+ [
101+
make_apple_clang_config("macos-13", ver, std_format_support=False)
102+
for ver in ["15.2"]
103+
]
105104
# std::format is available in Xcode 16.1 or later
106105
+ [
107106
make_apple_clang_config("macos-14", ver, std_format_support=True)

src/core/include/mp-units/framework/representation_concepts.h

+39-19
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ namespace mp_units {
4444
namespace detail {
4545

4646
template<typename T>
47-
concept WeaklyRegular =
48-
#ifndef MP_UNITS_XCODE15_HACKS
49-
true;
50-
#else
51-
std::copyable<T> && std::equality_comparable<T>;
52-
#endif
47+
concept WeaklyRegular = std::copyable<T> && std::equality_comparable<T>;
5348

5449
template<typename T, typename S>
5550
concept ScalableWith = requires(const T v, const S s) {
@@ -175,13 +170,18 @@ template<typename T>
175170
concept ComplexScalar =
176171
// TODO should the below be provided?
177172
// (!disable_complex<T>) &&
178-
Addable<T> && ScalableWith<T, T> && requires(const T v, const T& ref) {
173+
Addable<T> && ScalableWith<T, T> &&
174+
requires(const T v, const T& ref) {
179175
::mp_units::real(v);
180176
::mp_units::imag(v);
181177
::mp_units::modulus(v);
182178
requires ScalableWith<T, decltype(::mp_units::modulus(v))>;
183179
requires std::constructible_from<T, decltype(::mp_units::real(ref)), decltype(::mp_units::imag(ref))>;
184-
} && WeaklyRegular<T>;
180+
}
181+
#ifndef MP_UNITS_XCODE15_HACKS
182+
&& WeaklyRegular<T>
183+
#endif
184+
;
185185

186186
} // namespace detail
187187

@@ -197,8 +197,12 @@ MP_UNITS_INLINE constexpr bool disable_real<bool> = true;
197197
namespace detail {
198198

199199
template<typename T>
200-
concept RealScalar = (!disable_real<T>) && Addable<T> && ScalableWith<T, T> && std::totally_ordered<T> &&
201-
(!ComplexScalar<T>) && WeaklyRegular<T>;
200+
concept RealScalar =
201+
(!disable_real<T>) && Addable<T> && ScalableWith<T, T> && std::totally_ordered<T> && (!ComplexScalar<T>)
202+
#if MP_UNITS_COMP_GCC != 12 && !defined(MP_UNITS_XCODE15_HACKS)
203+
&& WeaklyRegular<T>
204+
#endif
205+
;
202206

203207
template<typename T>
204208
concept Scalar = RealScalar<T> || ComplexScalar<T>;
@@ -250,15 +254,20 @@ MP_UNITS_EXPORT inline constexpr ::mp_units::detail::magnitude_impl::magnitude_t
250254
namespace detail {
251255

252256
template<typename T>
253-
concept Vector = Addable<T> && requires(const T v) {
254-
::mp_units::magnitude(v);
255-
requires ScalableWith<T, decltype(::mp_units::magnitude(v))>;
256-
// TODO should we also check for the below (e.g., when `size() > 1` or `2`)
257-
// ::mp_units::zero_vector<T>();
258-
// ::mp_units::scalar_product(a, b);
259-
// ::mp_units::vector_product(a, b);
260-
// ::mp_units::tensor_product(a, b);
261-
} && WeaklyRegular<T>;
257+
concept Vector = Addable<T> &&
258+
requires(const T v) {
259+
::mp_units::magnitude(v);
260+
requires ScalableWith<T, decltype(::mp_units::magnitude(v))>;
261+
// TODO should we also check for the below (e.g., when `size() > 1` or `2`)
262+
// ::mp_units::zero_vector<T>();
263+
// ::mp_units::scalar_product(a, b);
264+
// ::mp_units::vector_product(a, b);
265+
// ::mp_units::tensor_product(a, b);
266+
}
267+
#ifndef MP_UNITS_XCODE15_HACKS
268+
&& WeaklyRegular<T>
269+
#endif
270+
;
262271

263272
} // namespace detail
264273

@@ -331,11 +340,22 @@ concept SomeRepresentation =
331340

332341
} // namespace detail
333342

343+
#ifdef MP_UNITS_XCODE15_HACKS
344+
MP_UNITS_EXPORT template<typename T, auto V>
345+
concept RepresentationOf =
346+
detail::SomeRepresentation<T> &&
347+
((QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(V))> &&
348+
(detail::QuantityKindSpec<MP_UNITS_REMOVE_CONST(decltype(V))> || detail::IsOfCharacter<T, V.character>)) ||
349+
(std::same_as<quantity_character, decltype(V)> && detail::IsOfCharacter<T, V>));
350+
351+
#else
352+
334353
MP_UNITS_EXPORT template<typename T, auto V>
335354
concept RepresentationOf =
336355
((QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(V))> &&
337356
((detail::QuantityKindSpec<MP_UNITS_REMOVE_CONST(decltype(V))> && detail::SomeRepresentation<T>) ||
338357
detail::IsOfCharacter<T, V.character>)) ||
339358
(std::same_as<quantity_character, decltype(V)> && detail::IsOfCharacter<T, V>));
359+
#endif
340360

341361
} // namespace mp_units

0 commit comments

Comments
 (0)