[libcxx-commits] [libcxx] 7e1355e - [libc++] Mark __wrap_iter's private constructors as explicit.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 4 10:24:54 PST 2022


Author: Arthur O'Dwyer
Date: 2022-03-04T13:24:38-05:00
New Revision: 7e1355eb1327ffa94f680e925e266b9404392f32

URL: https://github.com/llvm/llvm-project/commit/7e1355eb1327ffa94f680e925e266b9404392f32
DIFF: https://github.com/llvm/llvm-project/commit/7e1355eb1327ffa94f680e925e266b9404392f32.diff

LOG: [libc++] Mark __wrap_iter's private constructors as explicit.

This is slightly more user-visible than D119894, because the user is
expected to touch `__wrap_iter` directly. But the affected ctors are
non-public, so the user was never expected to be actually calling them.
And I didn't intentionally omit this from D119894; I just didn't
think of it.

Differential Revision: https://reviews.llvm.org/D120937

Added: 
    

Modified: 
    libcxx/include/__iterator/wrap_iter.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index d91a25ee6c8e7..69e5ee15aab25 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -136,13 +136,15 @@ class __wrap_iter
 
 private:
 #if _LIBCPP_DEBUG_LEVEL == 2
-    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+    explicit __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
     {
       if (!__libcpp_is_constant_evaluated())
         __get_db()->__insert_ic(this, __p);
     }
 #else
-    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+    explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
 #endif
 
     template <class _Up> friend class __wrap_iter;


        


More information about the libcxx-commits mailing list