On Wed, Jun 3, 2026 at 10:58 AM Tomasz Kaminski <[email protected]> wrote:
> > > On Fri, May 22, 2026 at 1:40 AM Jonathan Wakely <[email protected]> > wrote: > >> The P3471R4 and P3697R1 proposals adding hardened preconditions also >> defined feature test macros that can be tested to check if the hardened >> preconditions are checked. For our implementation, those checks are >> enabled by defining _GLIBCXX_ASSERTIONS. >> >> To implement this, I've aded all the __cpp_lib_hardened_xxx macros at >> the end of bits/version.def, because the simplest way to define many of >> them seems to be to make the depend on the macro for the main feature >> and additionally depend on defined(_GLIBCXX_ASSERTIONS). >> >> libstdc++-v3/ChangeLog: >> >> * include/bits/version.def: Define macros for hardened >> preconditions. >> * include/bits/version.h: Regenerate. >> * include/std/array: Define "want" macro for hardened >> precondition macro. >> * include/std/bitset: Likewise. >> * include/std/deque: Likewise. >> * include/std/expected: Likewise. >> * include/std/forward_list: Likewise. >> * include/std/inplace_vector: Likewise. >> * include/std/iterator: Likewise. >> * include/std/list: Likewise. >> * include/std/mdspan: Likewise. >> * include/std/memory: Likewise. >> * include/std/optional: Likewise. >> * include/std/ranges: Likewise. >> * include/std/span: Likewise. >> * include/std/stacktrace: Likewise. >> * include/std/string: Likewise. >> * include/std/string_view: Likewise. >> * include/std/valarray: Likewise. >> * include/std/vector: Likewise. >> * testsuite/23_containers/array/tuple_interface/get_neg.cc: >> Adjust dg-error line numbers. >> --- >> >> Tested x86_64-linux. >> > Review: > *p3471r4* > * basic_string: OK > * basic_string_view: OK > * bitset: OK > * deque: OK > * expected: OK > * forward_list: OK > * inplace_vector: OK > * list: OK > * mdspan: constructor precondition is not checked (maybe should be in > extent), I would like to revisit operator[] > * optional: OK > * span: assert missing for all constructors (for fixed size) > The checks are performed in `__extent_storage` constructor. > * valarray: OK > * vector: OK, outside of what Nathan pointed > > Drop span and mdspan from this commit, we should handle them separately, > Keep only the already implemented ones., > > *p3697*: > * basic_stacktrace: OK > * common_iterator: OK > * counted_iterator: OK > * shared_ptr_array: FTM not included in memory > * view_interface: FTM is missing, as you noticed, front/back are in, > should we do it separately with LWG4577 > > Fix FTM, otherwise, it looks good. > > issues: > * https://cplusplus.github.io/LWG/issue4214 - not accepted > * https://cplusplus.github.io/LWG/issue4276 - no change needed > * https://cplusplus.github.io/LWG/issue4408 - LEWG > * https://cplusplus.github.io/LWG/issue4577 - maybe do it, and then > define view_interface > > > >> libstdc++-v3/include/bits/version.def | 156 ++++++++++++++ >> libstdc++-v3/include/bits/version.h | 190 ++++++++++++++++++ >> libstdc++-v3/include/std/array | 1 + >> libstdc++-v3/include/std/bitset | 1 + >> libstdc++-v3/include/std/deque | 1 + >> libstdc++-v3/include/std/expected | 1 + >> libstdc++-v3/include/std/forward_list | 1 + >> libstdc++-v3/include/std/inplace_vector | 1 + >> libstdc++-v3/include/std/iterator | 2 + >> libstdc++-v3/include/std/list | 1 + >> libstdc++-v3/include/std/mdspan | 1 + >> libstdc++-v3/include/std/memory | 1 + >> libstdc++-v3/include/std/optional | 1 + >> libstdc++-v3/include/std/ranges | 1 + >> libstdc++-v3/include/std/span | 1 + >> libstdc++-v3/include/std/stacktrace | 1 + >> libstdc++-v3/include/std/string | 1 + >> libstdc++-v3/include/std/string_view | 1 + >> libstdc++-v3/include/std/valarray | 3 + >> libstdc++-v3/include/std/vector | 1 + >> .../array/tuple_interface/get_neg.cc | 6 +- >> 21 files changed, 370 insertions(+), 3 deletions(-) >> >> diff --git a/libstdc++-v3/include/bits/version.def >> b/libstdc++-v3/include/bits/version.def >> index 1f0d3a2670e5..e56c11b4179f 100644 >> --- a/libstdc++-v3/include/bits/version.def >> +++ b/libstdc++-v3/include/bits/version.def >> @@ -2030,6 +2030,16 @@ ftms = { >> }; >> }; >> >> +ftms = { >> + name = hardened_basic_stacktrace; >> + values = { >> + v = 202502; >> + cxxmin = 23; >> + hosted = yes; >> + extra_cond = "defined(__glibcxx_stacktrace) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> ftms = { >> name = start_lifetime_as; >> values = { >> @@ -2410,6 +2420,152 @@ ftms = { >> }; >> }; >> >> +ftms = { >> + name = hardened_array; >> + values = { >> + v = 202502; >> + cxxmin = 11; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_basic_string; >> + values = { >> + v = 202502; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_basic_string_view; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_string_view) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_bitset; >> + values = { >> + v = 202502; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_common_iterator; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_ranges) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_counted_iterator; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_ranges) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_deque; >> + values = { >> + v = 202502; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_expected; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_expected) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_forward_list; >> + values = { >> + v = 202502; >> + cxxmin = 11; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_inplace_vector; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_inplace_vector) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_list; >> + values = { >> + v = 202502; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_mdspan; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_mdspan) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_optional; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_optional) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_shared_ptr_array; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_shared_ptr_arrays) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_span; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_span) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_valarray; >> + values = { >> + v = 202502; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_vector; >> + values = { >> + v = 202502; >> + extra_cond = "defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> +ftms = { >> + name = hardened_view_interface; >> + values = { >> + v = 202502; >> + extra_cond = "defined(__glibcxx_ranges) && >> defined(_GLIBCXX_ASSERTIONS)"; >> + }; >> +}; >> + >> // Standard test specifications. >> stds[97] = ">= 199711L"; >> stds[03] = ">= 199711L"; >> diff --git a/libstdc++-v3/include/bits/version.h >> b/libstdc++-v3/include/bits/version.h >> index 66ac0ebef680..1d0beca30a8f 100644 >> --- a/libstdc++-v3/include/bits/version.h >> +++ b/libstdc++-v3/include/bits/version.h >> @@ -2256,6 +2256,16 @@ >> #endif /* !defined(__cpp_lib_stacktrace) */ >> #undef __glibcxx_want_stacktrace >> >> +#if !defined(__cpp_lib_hardened_basic_stacktrace) >> +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED && >> (defined(__glibcxx_stacktrace) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_basic_stacktrace 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_basic_stacktrace) >> +# define __cpp_lib_hardened_basic_stacktrace 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_basic_stacktrace) */ >> +#undef __glibcxx_want_hardened_basic_stacktrace >> + >> #if !defined(__cpp_lib_start_lifetime_as) >> # if (__cplusplus >= 202100L) >> # define __glibcxx_start_lifetime_as 202207L >> @@ -2675,4 +2685,184 @@ >> #endif /* !defined(__cpp_lib_is_structural) */ >> #undef __glibcxx_want_is_structural >> >> +#if !defined(__cpp_lib_hardened_array) >> +# if (__cplusplus >= 201103L) && (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_array 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_array) >> +# define __cpp_lib_hardened_array 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_array) */ >> +#undef __glibcxx_want_hardened_array >> + >> +#if !defined(__cpp_lib_hardened_basic_string) >> +# if (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_basic_string 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_basic_string) >> +# define __cpp_lib_hardened_basic_string 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_basic_string) */ >> +#undef __glibcxx_want_hardened_basic_string >> + >> +#if !defined(__cpp_lib_hardened_basic_string_view) >> +# if (defined(__glibcxx_string_view) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_basic_string_view 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_basic_string_view) >> +# define __cpp_lib_hardened_basic_string_view 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_basic_string_view) */ >> +#undef __glibcxx_want_hardened_basic_string_view >> + >> +#if !defined(__cpp_lib_hardened_bitset) >> +# if (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_bitset 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_bitset) >> +# define __cpp_lib_hardened_bitset 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_bitset) */ >> +#undef __glibcxx_want_hardened_bitset >> + >> +#if !defined(__cpp_lib_hardened_common_iterator) >> +# if (defined(__glibcxx_ranges) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_common_iterator 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_common_iterator) >> +# define __cpp_lib_hardened_common_iterator 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_common_iterator) */ >> +#undef __glibcxx_want_hardened_common_iterator >> + >> +#if !defined(__cpp_lib_hardened_counted_iterator) >> +# if (defined(__glibcxx_ranges) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_counted_iterator 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_counted_iterator) >> +# define __cpp_lib_hardened_counted_iterator 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_counted_iterator) */ >> +#undef __glibcxx_want_hardened_counted_iterator >> + >> +#if !defined(__cpp_lib_hardened_deque) >> +# if (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_deque 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_deque) >> +# define __cpp_lib_hardened_deque 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_deque) */ >> +#undef __glibcxx_want_hardened_deque >> + >> +#if !defined(__cpp_lib_hardened_expected) >> +# if (defined(__glibcxx_expected) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_expected 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_expected) >> +# define __cpp_lib_hardened_expected 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_expected) */ >> +#undef __glibcxx_want_hardened_expected >> + >> +#if !defined(__cpp_lib_hardened_forward_list) >> +# if (__cplusplus >= 201103L) && (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_forward_list 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_forward_list) >> +# define __cpp_lib_hardened_forward_list 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_forward_list) */ >> +#undef __glibcxx_want_hardened_forward_list >> + >> +#if !defined(__cpp_lib_hardened_inplace_vector) >> +# if (defined(__glibcxx_inplace_vector) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_inplace_vector 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_inplace_vector) >> +# define __cpp_lib_hardened_inplace_vector 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_inplace_vector) */ >> +#undef __glibcxx_want_hardened_inplace_vector >> + >> +#if !defined(__cpp_lib_hardened_list) >> +# if (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_list 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_list) >> +# define __cpp_lib_hardened_list 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_list) */ >> +#undef __glibcxx_want_hardened_list >> + >> +#if !defined(__cpp_lib_hardened_mdspan) >> +# if (defined(__glibcxx_mdspan) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_mdspan 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_mdspan) >> +# define __cpp_lib_hardened_mdspan 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_mdspan) */ >> +#undef __glibcxx_want_hardened_mdspan >> + >> +#if !defined(__cpp_lib_hardened_optional) >> +# if (defined(__glibcxx_optional) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_optional 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_optional) >> +# define __cpp_lib_hardened_optional 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_optional) */ >> +#undef __glibcxx_want_hardened_optional >> + >> +#if !defined(__cpp_lib_hardened_shared_ptr_array) >> +# if (defined(__glibcxx_shared_ptr_arrays) && >> defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_shared_ptr_array 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_shared_ptr_array) >> +# define __cpp_lib_hardened_shared_ptr_array 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_shared_ptr_array) */ >> +#undef __glibcxx_want_hardened_shared_ptr_array >> + >> +#if !defined(__cpp_lib_hardened_span) >> +# if (defined(__glibcxx_span) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_span 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_span) >> +# define __cpp_lib_hardened_span 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_span) */ >> +#undef __glibcxx_want_hardened_span >> + >> +#if !defined(__cpp_lib_hardened_valarray) >> +# if (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_valarray 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_valarray) >> +# define __cpp_lib_hardened_valarray 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_valarray) */ >> +#undef __glibcxx_want_hardened_valarray >> + >> +#if !defined(__cpp_lib_hardened_vector) >> +# if (defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_vector 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_vector) >> +# define __cpp_lib_hardened_vector 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_vector) */ >> +#undef __glibcxx_want_hardened_vector >> + >> +#if !defined(__cpp_lib_hardened_view_interface) >> +# if (defined(__glibcxx_ranges) && defined(_GLIBCXX_ASSERTIONS)) >> +# define __glibcxx_hardened_view_interface 202502L >> +# if defined(__glibcxx_want_all) || >> defined(__glibcxx_want_hardened_view_interface) >> +# define __cpp_lib_hardened_view_interface 202502L >> +# endif >> +# endif >> +#endif /* !defined(__cpp_lib_hardened_view_interface) */ >> +#undef __glibcxx_want_hardened_view_interface >> + >> #undef __glibcxx_want_all >> diff --git a/libstdc++-v3/include/std/array >> b/libstdc++-v3/include/std/array >> index 22f6251d4fe3..5d3edbea6495 100644 >> --- a/libstdc++-v3/include/std/array >> +++ b/libstdc++-v3/include/std/array >> @@ -49,6 +49,7 @@ >> >> #define __glibcxx_want_array_constexpr >> #define __glibcxx_want_freestanding_array >> +#define __glibcxx_want_hardened_array >> #define __glibcxx_want_nonmember_container_access >> #define __glibcxx_want_to_array >> #include <bits/version.h> >> diff --git a/libstdc++-v3/include/std/bitset >> b/libstdc++-v3/include/std/bitset >> index 64dae5be8bf9..a8cb337f4b15 100644 >> --- a/libstdc++-v3/include/std/bitset >> +++ b/libstdc++-v3/include/std/bitset >> @@ -62,6 +62,7 @@ >> >> #define __glibcxx_want_constexpr_bitset >> #define __glibcxx_want_bitset // ...construct from string_view >> +#define __glibcxx_want_hardened_bitset >> #include <bits/version.h> >> >> #ifdef __cpp_lib_bitset // ...construct from string_view >> diff --git a/libstdc++-v3/include/std/deque >> b/libstdc++-v3/include/std/deque >> index 3899b68e7367..3b2f34fc7075 100644 >> --- a/libstdc++-v3/include/std/deque >> +++ b/libstdc++-v3/include/std/deque >> @@ -75,6 +75,7 @@ >> #define __glibcxx_want_allocator_traits_is_always_equal >> #define __glibcxx_want_containers_ranges >> #define __glibcxx_want_erase_if >> +#define __glibcxx_want_hardened_deque >> #define __glibcxx_want_nonmember_container_access >> #include <bits/version.h> >> >> diff --git a/libstdc++-v3/include/std/expected >> b/libstdc++-v3/include/std/expected >> index 21522850d7ae..fe4e1ecbf0ec 100644 >> --- a/libstdc++-v3/include/std/expected >> +++ b/libstdc++-v3/include/std/expected >> @@ -37,6 +37,7 @@ >> #define __glibcxx_want_freestanding_expected >> #define __glibcxx_want_constrained_equality >> #define __glibcxx_want_constexpr_exceptions >> +#define __glibcxx_want_hardened_expected >> #include <bits/version.h> >> >> #ifdef __cpp_lib_expected // C++ >= 23 && __cpp_concepts >= 202002L >> diff --git a/libstdc++-v3/include/std/forward_list >> b/libstdc++-v3/include/std/forward_list >> index ff0c58455cf5..e24c1573e0ad 100644 >> --- a/libstdc++-v3/include/std/forward_list >> +++ b/libstdc++-v3/include/std/forward_list >> @@ -51,6 +51,7 @@ >> #define __glibcxx_want_allocator_traits_is_always_equal >> #define __glibcxx_want_containers_ranges >> #define __glibcxx_want_erase_if >> +#define __glibcxx_want_hardened_forward_list >> #define __glibcxx_want_incomplete_container_elements >> #define __glibcxx_want_list_remove_return_type >> #define __glibcxx_want_nonmember_container_access >> diff --git a/libstdc++-v3/include/std/inplace_vector >> b/libstdc++-v3/include/std/inplace_vector >> index 0096bd83a175..46a750943629 100644 >> --- a/libstdc++-v3/include/std/inplace_vector >> +++ b/libstdc++-v3/include/std/inplace_vector >> @@ -32,6 +32,7 @@ >> >> #pragma GCC system_header >> >> +#define __glibcxx_want_hardened_inplace_vector >> #define __glibcxx_want_inplace_vector >> #include <bits/version.h> >> >> diff --git a/libstdc++-v3/include/std/iterator >> b/libstdc++-v3/include/std/iterator >> index 96696cc53593..3d2dc8bbe9e4 100644 >> --- a/libstdc++-v3/include/std/iterator >> +++ b/libstdc++-v3/include/std/iterator >> @@ -71,6 +71,8 @@ >> >> #define __glibcxx_want_array_constexpr >> #define __glibcxx_want_constexpr_iterator >> +#define __glibcxx_want_hardened_common_iterator >> +#define __glibcxx_want_hardened_counted_iterator >> #define __glibcxx_want_make_reverse_iterator >> #define __glibcxx_want_move_iterator_concept >> #define __glibcxx_want_nonmember_container_access >> diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list >> index a3e7c81680a9..29d8fce698bc 100644 >> --- a/libstdc++-v3/include/std/list >> +++ b/libstdc++-v3/include/std/list >> @@ -75,6 +75,7 @@ >> #define __glibcxx_want_allocator_traits_is_always_equal >> #define __glibcxx_want_containers_ranges >> #define __glibcxx_want_erase_if >> +#define __glibcxx_want_hardened_list >> #define __glibcxx_want_incomplete_container_elements >> #define __glibcxx_want_list_remove_return_type >> #define __glibcxx_want_nonmember_container_access >> diff --git a/libstdc++-v3/include/std/mdspan >> b/libstdc++-v3/include/std/mdspan >> index adc1c0c64219..8545a1276fcd 100644 >> --- a/libstdc++-v3/include/std/mdspan >> +++ b/libstdc++-v3/include/std/mdspan >> @@ -40,6 +40,7 @@ >> >> #define __glibcxx_want_mdspan >> #define __glibcxx_want_aligned_accessor >> +#define __glibcxx_want_hardened_mdspan >> #define __glibcxx_want_submdspan >> #include <bits/version.h> >> >> diff --git a/libstdc++-v3/include/std/memory >> b/libstdc++-v3/include/std/memory >> index cbe9f5ad2007..9343b3497315 100644 >> --- a/libstdc++-v3/include/std/memory >> +++ b/libstdc++-v3/include/std/memory >> @@ -110,6 +110,7 @@ >> #define __glibcxx_want_constexpr_dynamic_alloc >> #define __glibcxx_want_constexpr_memory >> #define __glibcxx_want_enable_shared_from_this >> +#define __glibcxx_want_hardened_shared_ptr_array >> #define __glibcxx_want_indirect >> #define __glibcxx_want_is_sufficiently_aligned >> #define __glibcxx_want_make_unique >> diff --git a/libstdc++-v3/include/std/optional >> b/libstdc++-v3/include/std/optional >> index 8d6d049e8ccc..34fa547e5c10 100644 >> --- a/libstdc++-v3/include/std/optional >> +++ b/libstdc++-v3/include/std/optional >> @@ -39,6 +39,7 @@ >> #define __glibcxx_want_optional_range_support >> #define __glibcxx_want_constrained_equality >> #define __glibcxx_want_constexpr_exceptions >> +#define __glibcxx_want_hardened_optional >> #include <bits/version.h> >> >> #ifdef __cpp_lib_optional // C++ >= 17 >> diff --git a/libstdc++-v3/include/std/ranges >> b/libstdc++-v3/include/std/ranges >> index 7d8b37f8c5cf..a0679fa9e5cc 100644 >> --- a/libstdc++-v3/include/std/ranges >> +++ b/libstdc++-v3/include/std/ranges >> @@ -56,6 +56,7 @@ >> #include <bits/refwrap.h> >> >> #define __glibcxx_want_algorithm_default_value_type >> +#define __glibcxx_want_hardened_vector >> #define __glibcxx_want_ranges >> #define __glibcxx_want_ranges_as_const >> #define __glibcxx_want_ranges_as_rvalue >> diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span >> index aaa7a485be8c..2b978dad8a4d 100644 >> --- a/libstdc++-v3/include/std/span >> +++ b/libstdc++-v3/include/std/span >> @@ -40,6 +40,7 @@ >> >> #define __glibcxx_want_span >> #define __glibcxx_want_span_initializer_list >> +#define __glibcxx_want_hardened_span >> #include <bits/version.h> >> >> #ifdef __cpp_lib_span // C++ >= 20 && concepts >> diff --git a/libstdc++-v3/include/std/stacktrace >> b/libstdc++-v3/include/std/stacktrace >> index 79941d93b88f..22d8b804a5e9 100644 >> --- a/libstdc++-v3/include/std/stacktrace >> +++ b/libstdc++-v3/include/std/stacktrace >> @@ -34,6 +34,7 @@ >> >> #define __glibcxx_want_stacktrace >> #define __glibcxx_want_formatters >> +#define __glibcxx_want_hardened_basic_stacktrace >> #include <bits/version.h> >> >> #ifdef __cpp_lib_stacktrace // C++ >= 23 && hosted && HAVE_STACKTRACE >> diff --git a/libstdc++-v3/include/std/string >> b/libstdc++-v3/include/std/string >> index c2b37391fc7a..1a622b7aebd6 100644 >> --- a/libstdc++-v3/include/std/string >> +++ b/libstdc++-v3/include/std/string >> @@ -72,6 +72,7 @@ >> #define __glibcxx_want_constexpr_string >> #define __glibcxx_want_containers_ranges >> #define __glibcxx_want_erase_if >> +#define __glibcxx_want_hardened_basic_string >> #define __glibcxx_want_nonmember_container_access >> #define __glibcxx_want_string_resize_and_overwrite >> #define __glibcxx_want_string_subview >> diff --git a/libstdc++-v3/include/std/string_view >> b/libstdc++-v3/include/std/string_view >> index 81b0011245b5..ce6aee290524 100644 >> --- a/libstdc++-v3/include/std/string_view >> +++ b/libstdc++-v3/include/std/string_view >> @@ -40,6 +40,7 @@ >> #define __glibcxx_want_constexpr_char_traits >> #define __glibcxx_want_constexpr_string_view >> #define __glibcxx_want_freestanding_string_view >> +#define __glibcxx_want_hardened_basic_string_view >> #define __glibcxx_want_starts_ends_with >> #define __glibcxx_want_string_contains >> #define __glibcxx_want_string_subview >> diff --git a/libstdc++-v3/include/std/valarray >> b/libstdc++-v3/include/std/valarray >> index abb158d22c35..ef34fed07caa 100644 >> --- a/libstdc++-v3/include/std/valarray >> +++ b/libstdc++-v3/include/std/valarray >> @@ -46,6 +46,9 @@ >> #include <bits/range_access.h> >> #endif >> >> +#define __glibcxx_want_hardened_valarray >> +#include <bits/version.h> >> + >> namespace std _GLIBCXX_VISIBILITY(default) >> { >> _GLIBCXX_BEGIN_NAMESPACE_VERSION >> diff --git a/libstdc++-v3/include/std/vector >> b/libstdc++-v3/include/std/vector >> index 343483e95191..86e42b22ea5b 100644 >> --- a/libstdc++-v3/include/std/vector >> +++ b/libstdc++-v3/include/std/vector >> @@ -83,6 +83,7 @@ >> #define __glibcxx_want_constexpr_vector >> #define __glibcxx_want_containers_ranges >> #define __glibcxx_want_erase_if >> +#define __glibcxx_want_hardened_vector >> #define __glibcxx_want_incomplete_container_elements >> #define __glibcxx_want_nonmember_container_access >> #include <bits/version.h> >> diff --git >> a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc >> b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc >> index c71ddf91f645..0772581226de 100644 >> --- >> a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc >> +++ >> b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc >> @@ -26,6 +26,6 @@ int n1 = std::get<1>(a); >> int n2 = std::get<1>(std::move(a)); >> int n3 = std::get<1>(ca); >> >> -// { dg-error "static assertion failed" "" { target *-*-* } 396 } >> -// { dg-error "static assertion failed" "" { target *-*-* } 405 } >> -// { dg-error "static assertion failed" "" { target *-*-* } 414 } >> +// { dg-error "static assertion failed" "" { target *-*-* } 397 } >> +// { dg-error "static assertion failed" "" { target *-*-* } 406 } >> +// { dg-error "static assertion failed" "" { target *-*-* } 415 } >> -- >> 2.54.0 >> >>
