Skip to content

Commit 2fb0c5f

Browse files
committed
Fix constrained ALP template exports
Move the decode target restriction from requires clauses to static assertions, so an invalid target stays a compile-time error without the constraint appearing in exported symbol names. GCC can then match the explicit instantiations, and Clang shared builds resolve the same symbols.
1 parent 642ee4e commit 2fb0c5f

4 files changed

Lines changed: 2 additions & 4 deletions

File tree

‎cpp/src/arrow/util/alp/alp_codec.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ Result<int64_t> AlpVectorReader<T>::VectorSizeInBytes(int32_t vector_index) cons
426426

427427
template <AlpFloatingType T>
428428
template <typename TargetType>
429-
requires AlpDecodeTarget<T, TargetType>
430429
Status AlpVectorReader<T>::Decode(int32_t vector_index, std::span<TargetType> output) {
430+
static_assert(AlpDecodeTarget<T, TargetType>);
431431
ARROW_ASSIGN_OR_RAISE(const VectorLayout layout, LoadVectorLayout(vector_index));
432432
if (output.size() != static_cast<size_t>(layout.num_elements)) {
433433
return Status::Invalid("ALP output size does not match vector length: ",

‎cpp/src/arrow/util/alp/alp_codec_internal.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class ARROW_EXPORT AlpVectorReader {
7676
/// `output` must contain exactly `VectorLength(vector_index)` elements.
7777
/// `TargetType` may be wider than `T`, but not narrower.
7878
template <typename TargetType>
79-
requires AlpDecodeTarget<T, TargetType>
8079
Status Decode(int32_t vector_index, std::span<TargetType> output);
8180

8281
private:

‎cpp/src/arrow/util/alp/alp_compression.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,10 @@ void AlpCompression<T>::PatchExceptions(
540540

541541
template <AlpFloatingType T>
542542
template <typename TargetType>
543-
requires AlpDecodeTarget<T, TargetType>
544543
void AlpCompression<T>::Decompress(const AlpEncodedVectorView<T>& encoded_view,
545544
std::span<TargetType> outputs,
546545
std::span<EncodedUnsigned> integer_scratch) {
546+
static_assert(AlpDecodeTarget<T, TargetType>);
547547
const AlpInfo& alp_info = encoded_view.alp_info();
548548
const AlpForInfo<T>& for_info = encoded_view.for_info();
549549
const size_t num_elements = static_cast<size_t>(encoded_view.num_elements());

‎cpp/src/arrow/util/alp/alp_compression_internal.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class ARROW_EXPORT AlpCompression {
7474
/// `outputs` and `integer_scratch` must each hold at least
7575
/// `encoded_view.num_elements()` elements.
7676
template <typename TargetType>
77-
requires AlpDecodeTarget<T, TargetType>
7877
static void Decompress(const AlpEncodedVectorView<T>& encoded_view,
7978
std::span<TargetType> outputs,
8079
std::span<EncodedUnsigned> integer_scratch);

0 commit comments

Comments
 (0)