Skip to content

tests: fix std::min type mismatch in geometry_test (macOS arm64) - #56

Merged
transfix merged 1 commit into
masterfrom
fix/macos-min-type-mismatch
May 11, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/macos-min-type-mismatch

Conversation

@transfix

Copy link
Copy Markdown
Owner

std::min(source.num_points(), size_t(100)) fails to deduce _Tp on macOS arm64 where size_t is unsigned long but num_points() returns uint64_t (= unsigned long long). Linux x86_64 happens to typedef both as unsigned long so this only broke on macOS.

Was latent until #55 turned on CVC_BUILD_TESTS=ON in the macOS package-* jobs. Fix is a one-line explicit template arg.

-  for (size_t i = 0; i < std::min(source.num_points(), size_t(100)); i++) {
+  for (size_t i = 0; i < std::min<size_t>(source.num_points(), 100); i++) {

geometry_test.cpp:1030 called std::min(source.num_points(), size_t(100))
where num_points() returns uint64_t. On macOS arm64 size_t is unsigned
long and uint64_t is unsigned long long; even though they are the same
width, template deduction fails. Linux x86_64 happens to typedef both
as unsigned long so this only broke on macOS.

The bug was latent until #55 turned on CVC_BUILD_TESTS=ON in the macOS
package-* jobs. Use an explicit template argument so the literal 100
just deduces to size_t.
@transfix
transfix merged commit 3fbdbd5 into master May 11, 2026
9 of 13 checks passed
@transfix
transfix deleted the fix/macos-min-type-mismatch branch May 11, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant