GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++ Breaking Change

Libstdc++ Reverts to Dynamic Sizing for ref_view

The library now calculates the size of `ref_view` dynamically, reverting a change that made it statically sized and caused unexpected type changes.

The libstdc++ library reverted a change that made ref_view<R> statically sized, except for the introduction of ranges::__static_size. The static sizing led to unexpected changes in return types for functions like define_static_array, where the return type changed from span<const ...> to span<const ..., 10>. This behavior was deemed beyond the scope of implementation freedom and the change was reverted until P3928R0 is accepted.

In Details

The commit reverts changes related to making ref_view<R> statically sized, preserving the introduction of ranges::__static_size. Breaking inplace_vector preconditions and changes in the return type of define_static_array on adapted ref_view instances motivated the reversion.

For Context

The C++ standard library provides tools for working with ranges of data. ref_view is a way to view an existing range without copying the data. This commit reverts a change that attempted to make the size of a ref_view known at compile time (statically sized). This change had unintended consequences, altering the return types of some functions in ways that could break existing code. The change was reverted to avoid these issues and will be reconsidered when a related proposal is accepted into the C++ standard.

Filed Under: libstdc++rangesref_viewrevert