[PATCH] libstdc++: Include range_access.h from <optional>, <stacktrace> and <valarray>

Tomasz Kamiński tkaminsk@redhat.com
Fri May 15 15:10:15 GMT 2026


As the range accessor all already conditionally noexcept, this implements
LWG4131 and LWG3625 (also part 4.8. section of the P3016R6). As for any
LWG issue resolutions, changes are applied as DR for oldest applicable
standards:
* <optional> (LWG4131): C++26, since optional range support
* <stacktrace> (LWG3625): C++23, since introduction

libstdc++-v3/ChangeLog:

	* include/std/optional [__cpp_lib_optional_range_support]:
	Replace <bits/stl_iterator.h> include with <bits/range_access.h>.
	* include/std/stacktrace: Likewise.
---
 libstdc++-v3/include/std/optional   | 2 +-
 libstdc++-v3/include/std/stacktrace | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index e3c6ea20988..8d6d049e8cc 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -62,7 +62,7 @@
 #ifdef __cpp_lib_optional_range_support // C++ >= 26
 # include <bits/formatfwd.h>
 # include <bits/ranges_base.h>
-# include <bits/stl_iterator.h>
+# include <bits/range_access.h>
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace
index 587a163e976..79941d93b88 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -45,9 +45,9 @@
 #include <bits/memory_resource.h>
 #include <bits/stl_algobase.h>
 #include <bits/stl_algo.h>
-#include <bits/stl_iterator.h>
 #include <bits/stl_uninitialized.h>
 #include <bits/stl_tempbuf.h> // __get_temporary_buffer
+#include <bits/range_access.h>
 #include <ext/numeric_traits.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
-- 
2.54.0



More information about the Libstdc++ mailing list