Skip to content

refactor(data): raw_poly_vector launders its array pointers - #15

Merged
codethinki merged 2 commits into
masterfrom
refactor/poly-vector-lifetime
Oct 16, 2026
Merged

codethinki merged 2 commits into
masterfrom
refactor/poly-vector-lifetime

Conversation

@codethinki

@codethinki codethinki commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Resolves the // TEMP use std::start_lifetime_as_array in raw_poly_vector::data().

  • the storage comes from ::operator new, which implicitly creates objects of implicit lifetime types ([intro.object]), so the arrays already exist
  • data<I>() returns std::launder of the pointer instead of the plain reinterpret_cast
  • std::start_lifetime_as_array is not needed here. The first version used it: the MSVC STL only declares it for the MSVC compiler (TRANSITION, GH-6169, clang lacks __builtin_start_lifetime_as_array), so Windows clang failed.

Tested locally with gcc 16 and clang 23 (gcc_debug, clang_debug, gcc_release, clang_release: 263/263 tests).

Resolves the TEMP in raw_poly_vector::data(): std::start_lifetime_as_array needs the element count,
which data() does not know. realloc() knows it and starts the lifetime of each array once,
data() launders the pointer to the started array.
::operator new implicitly creates objects of implicit lifetime types in the returned storage,
start_lifetime_as_array is not needed. It is also missing in the MSVC STL on clang (microsoft/STL GH-6169).
@codethinki codethinki changed the title refactor(data): raw_poly_vector starts the lifetime of its arrays refactor(data): raw_poly_vector launders its array pointers Oct 16, 2026
@codethinki
codethinki merged commit 9dba9e9 into master Oct 16, 2026
6 checks passed
@codethinki
codethinki deleted the refactor/poly-vector-lifetime branch October 16, 2026 23:11
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