Skip to content

[libc++] ABI break: std::ranges::zip_view #158730

@zibi2

Description

@zibi2

Compiling std/ranges/range.adaptors/range.zip/sentinel/minus.pass.cpp with -std=c++26 -Xclang -fdump-record-layouts-canonical -fsyntax-only against LLVM 19 and LLVM 21 will result with the following difference:

          0 | class std::ranges::zip_view<class std::ranges::iota_view<int>, struct SizedRandomAccessView>::__sentinel<true>
-         0 |   struct std::pair<struct std::unreachable_sentinel_t, class sized_sentinel<class random_access_iterator<int *> > > __end_
-         0 |     struct std::unreachable_sentinel_t first (empty)
-         8 |     class sized_sentinel<class random_access_iterator<int *> > second
-         8 |       int * base_
-           | [sizeof=16, dsize=16, align=8,
-           |  nvsize=16, nvalign=8]
+         0 |   class std::tuple<struct std::unreachable_sentinel_t, class sized_sentinel<class random_access_iterator<int *> > > __end_
+         0 |     struct std::__tuple_impl<struct std::__tuple_indices<0, 1>, struct std::unreachable_sentinel_t, class sized_sentinel<class random_access_iterator<int *> > > __base_
+         0 |       class std::__tuple_leaf<0, struct std::unreachable_sentinel_t> (base) (empty)
+         0 |         struct std::unreachable_sentinel_t (base) (empty)
+         0 |       class std::__tuple_leaf<1, class sized_sentinel<class random_access_iterator<int *> > > (base)
+         0 |         class sized_sentinel<class random_access_iterator<int *> > __value_
+         0 |           int * base_
+           | [sizeof=8, dsize=8, align=8,
+           |  nvsize=8, nvalign=8]

Notice that size difference for template class __sentinel changed from size 16 to just 8.

If we have an aggregate such as an array with elements of this type, traversing it should not pose a problem in LLVM 21’s libc++ when the code is compiled with LLVM 19?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary Interfacelibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions