Landing: e38acbc88bfe

Project / Subsystem

gcc / libstdc++

Date

2026-04-24

Author

Tomasz Kamiński

Commit

e38acbc88bfede15884009330ab75debb114905d

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
commit_hash
e38acbc88bfede15884009330ab75debb114905d
source_type
github
headline
Libstdc++: Static_assert that static sized range size is less than inplace_vector capacity
tldr
Adds static assertions to `inplace_vector` to ensure the size of a statically-sized input range doesn't exceed its capacity.
author
Tomasz Kamiński
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • libstdc++
  • inplace_vector
  • ranges
  • static_assert
  • lwg
discussion_id_link
bugzilla_pr
date
2026-04-24T00:00:00.000Z

This commit resolves LWG 4396 by improving the inplace_vector(from_range_t, R&& rg) constructor. It introduces static_assert checks to verify that the size of the input range R does not exceed the capacity of the inplace_vector at compile time, preventing potential buffer overflows. The commit also adds test cases to demonstrate how views applied to span<T, N> remain statically sized, while those applied to array<T, N> do not, due to the pointer semantics of ref_view.