Skip to content

[cmake] Check std::vector layout - #24000

Merged
jblomer merged 2 commits into
root-project:masterfrom
jblomer:ntuple-new-vector
Nov 7, 2026
Merged

jblomer merged 2 commits into
root-project:masterfrom
jblomer:ntuple-new-vector

Conversation

@jblomer

@jblomer jblomer commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

The std::vector layout, currently, uses three pointers (begin, end, end
of capacity). This is used by the ROOT I/O to work with vectors of
anything by treating any vector as a vector. The approach breaks,
however, with the std::vector layout in the libc++ unstable ABI that
implements vector with one pointer and two integers.

See also https://discourse.llvm.org/t/adding-a-size-based-vector-to-libc-s-unstable-abi/86306

Tested on Linux with clang 23 and latest libc++ built from sources.

@jblomer jblomer self-assigned this Nov 5, 2026
@jblomer
jblomer requested a review from bellenot as a code owner November 5, 2026 13:00
@jblomer jblomer added the in:I/O label Nov 5, 2026
Comment thread cmake/modules/check_libcpp_vector.cpp Resolved
Comment thread cmake/modules/CheckCompiler.cmake Resolved
Found by compiling with clang/libc++ on Linux.
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 10h 30m 55s ⏱️
 3 884 tests  3 884 ✅ 0 💤 0 ❌
72 199 runs  72 199 ✅ 0 💤 0 ❌

Results for commit c9e9035.

♻️ This comment has been updated with latest results.

@pcanal pcanal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

The std::vector layout, currently, uses three pointers (begin, end, end
of capacity). This is used by the ROOT I/O to work with vectors of
anything by treating any vector as a vector<char>.  The approach breaks,
however, with the std::vector layout in the libc++ unstable ABI that
implements vector with one pointer and two integers.
@jblomer
jblomer merged commit b81f858 into root-project:master Nov 7, 2026
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants