From f7dcdf7d3ac7f0d8d3384b44b096f1ebabb07e0f Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Mon, 9 Nov 2026 10:40:44 -0500 Subject: [PATCH 1/4] swap out concepts/invocable --- cpp/src/arrow/compute/kernels/codegen_internal.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/compute/kernels/codegen_internal.h b/cpp/src/arrow/compute/kernels/codegen_internal.h index 405f35a9234b..d51fd7c9a0e0 100644 --- a/cpp/src/arrow/compute/kernels/codegen_internal.h +++ b/cpp/src/arrow/compute/kernels/codegen_internal.h @@ -17,7 +17,6 @@ #pragma once -#include #include #include #include @@ -1234,9 +1233,12 @@ struct GeneratorApplicator { using Type = GeneratorApplicator::Type; }; +// std::is_invocable_v is used instead of the std::invocable concept because some +// older standard library implementations (e.g., macOS 11.x libc++, used by CRAN) +// have partial C++20 concepts support and lack std::invocable. template class Generator, typename... Args> - requires std::invocable + requires std::is_invocable_v auto GenerateKernelExecImpl(Type::type id) { constexpr auto kNumTypeIds = std::tuple_size_v; static_assert(ArrayIndex < kNumTypeIds); @@ -1272,7 +1274,7 @@ auto GenerateKernelExecImpl(Type::type id) { template class Generator, typename... Args> - requires std::invocable + requires std::is_invocable_v auto GenerateKernelExec(detail::GetTypeId get_id) { return detail::GenerateKernelExecImpl(get_id.id); From 91a7cc6aa3d29c60991ea17caaa735d2c32f8ae7 Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Mon, 9 Nov 2026 10:43:40 -0500 Subject: [PATCH 2/4] ditch in_range too --- cpp/src/parquet/column_reader.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cpp/src/parquet/column_reader.cc b/cpp/src/parquet/column_reader.cc index 6aca8a23ce16..4a035bb2756c 100644 --- a/cpp/src/parquet/column_reader.cc +++ b/cpp/src/parquet/column_reader.cc @@ -83,10 +83,21 @@ inline void CheckNumberDecoded(int64_t number_decoded, int64_t expected) { } } -/// True if a T can hold a U. +/// True if an integer type T can hold every value of integer type U. +/// +/// Written in terms of std::numeric_limits rather than std::in_range because +/// the libc++ in the macOS 11.3 SDK used by CRAN does not provide the latter. template -inline constexpr bool can_hold_v = std::in_range(std::numeric_limits::min()) && - std::in_range(std::numeric_limits::max()); +inline constexpr bool can_hold_v = + std::numeric_limits::digits >= std::numeric_limits::digits && + (std::is_signed_v || !std::is_signed_v); + +static_assert(can_hold_v); +static_assert(can_hold_v); +static_assert(can_hold_v); +static_assert(!can_hold_v); +static_assert(!can_hold_v); +static_assert(!can_hold_v); /// Clamp to a given type. template From cc05f472c447523ee028eb85299737cdfc1f630f Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Mon, 9 Nov 2026 10:46:54 -0500 Subject: [PATCH 3/4] future-proof it --- cpp/src/parquet/column_reader.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cpp/src/parquet/column_reader.cc b/cpp/src/parquet/column_reader.cc index 4a035bb2756c..26e75639a0c3 100644 --- a/cpp/src/parquet/column_reader.cc +++ b/cpp/src/parquet/column_reader.cc @@ -88,9 +88,16 @@ inline void CheckNumberDecoded(int64_t number_decoded, int64_t expected) { /// Written in terms of std::numeric_limits rather than std::in_range because /// the libc++ in the macOS 11.3 SDK used by CRAN does not provide the latter. template -inline constexpr bool can_hold_v = - std::numeric_limits::digits >= std::numeric_limits::digits && - (std::is_signed_v || !std::is_signed_v); +struct CanHold { + static_assert(std::is_integral_v && std::is_integral_v, + "can_hold_v is only defined for integer types"); + static constexpr bool value = + std::numeric_limits::digits >= std::numeric_limits::digits && + (std::is_signed_v || !std::is_signed_v); +}; + +template +inline constexpr bool can_hold_v = CanHold::value; static_assert(can_hold_v); static_assert(can_hold_v); From 5308b1a1b326d2f7635c21cde374189669f21161 Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Mon, 9 Nov 2026 11:50:34 -0500 Subject: [PATCH 4/4] Update cpp/src/parquet/column_reader.cc Co-authored-by: Antoine Pitrou --- cpp/src/parquet/column_reader.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/src/parquet/column_reader.cc b/cpp/src/parquet/column_reader.cc index 26e75639a0c3..8594acb41d69 100644 --- a/cpp/src/parquet/column_reader.cc +++ b/cpp/src/parquet/column_reader.cc @@ -104,6 +104,7 @@ static_assert(can_hold_v); static_assert(can_hold_v); static_assert(!can_hold_v); static_assert(!can_hold_v); +static_assert(!can_hold_v); static_assert(!can_hold_v); /// Clamp to a given type.