Skip to content

[C++] std::identity in bitmap_ops.cc breaks build with macOS 11.3 SDK #50987

Description

@thisisnic

Describe the bug, including details regarding any error messages, version, and platform.

(Written by Claude, message reviewed by @thisisnic before posting)

Since #50785 was merged, Arrow C++ fails to compile in the R macOS CRAN nightly (test-r-macos-as-cran, cran-release config):

https://github.com/ursacomputing/crossbow/actions/runs/32845953430/job/97795549784

cpp/src/arrow/util/bitmap_ops.cc:230:57: error: no template named 'identity' in namespace 'std'; did you mean '__identity'?

The same error appears at lines 307 and 323 (MapBitmapUnary<std::identity>):

if constexpr (std::is_same_v<std::decay_t<Op>, std::identity>) {

This job builds against the macOS 11.3 SDK to match CRAN's macOS builder. The libc++ headers in that SDK predate std::identity (added in libc++ 12 / macOS 12 SDK), so it is unavailable even with -std=gnu++20. The cran-m1 config, which uses the current Xcode SDK, passes.

This is the only use of std::identity in cpp/src, so replacing it with a local identity functor should be enough. Without a fix, the R package will fail to build on CRAN's macOS builder at the next release.

Component(s)

C++

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions