[libcxx-commits] [libcxx] 46d9d4b - [libc++] Guard `optional::iterator` range variables behind experimental (#175222)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 9 22:04:29 PST 2026


Author: William Tran-Viet
Date: 2026-01-10T14:04:24+08:00
New Revision: 46d9d4b2e000e309987dfc332b3822ab8703fca0

URL: https://github.com/llvm/llvm-project/commit/46d9d4b2e000e309987dfc332b3822ab8703fca0
DIFF: https://github.com/llvm/llvm-project/commit/46d9d4b2e000e309987dfc332b3822ab8703fca0.diff

LOG: [libc++] Guard `optional::iterator` range variables behind experimental (#175222)

Added: 
    

Modified: 
    libcxx/include/optional
    libcxx/modules/std/optional.inc

Removed: 
    


################################################################################
diff  --git a/libcxx/include/optional b/libcxx/include/optional
index cc6a30151c53a..12fbcdfa5c5d6 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -661,7 +661,7 @@ using __optional_sfinae_assign_base_t _LIBCPP_NODEBUG =
 template <class _Tp>
 class optional;
 
-#    if _LIBCPP_STD_VER >= 26
+#    if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
 template <class _Tp>
 constexpr bool ranges::enable_view<optional<_Tp>> = true;
 

diff  --git a/libcxx/modules/std/optional.inc b/libcxx/modules/std/optional.inc
index 88de0bb4db12b..8196a8dde577c 100644
--- a/libcxx/modules/std/optional.inc
+++ b/libcxx/modules/std/optional.inc
@@ -10,7 +10,7 @@
 export namespace std {
   // [optional.optional], class template optional
   using std::optional;
-#if _LIBCPP_STD_VER >= 26
+#if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
   // [optional.iterators], iterator support
   namespace ranges {
     using std::ranges::enable_borrowed_range;
@@ -24,7 +24,7 @@ export namespace std {
   // [optional.bad.access], class bad_optional_access
   using std::bad_optional_access;
 
-#if _LIBCPP_STD_VER >= 26
+#if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
   using std::format_kind;
 #endif
 


        


More information about the libcxx-commits mailing list