[libcxx-commits] [PATCH] D120937: [libc++] Mark __wrap_iter's private constructors as explicit

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 3 12:47:07 PST 2022


Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, libc++.
Quuxplusone added a project: libc++.
Herald added a project: All.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

This is slightly more user-visible than D119894 <https://reviews.llvm.org/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 <https://reviews.llvm.org/D119894>; I just didn't
think of it.

(Btw, I noticed this as a result of researching https://quuxplusone.github.io/blog/2022/03/03/why-isnt-vector-iterator-just-t-star/ )


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120937

Files:
  libcxx/include/__iterator/wrap_iter.h


Index: libcxx/include/__iterator/wrap_iter.h
===================================================================
--- libcxx/include/__iterator/wrap_iter.h
+++ libcxx/include/__iterator/wrap_iter.h
@@ -136,13 +136,15 @@
 
 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120937.412817.patch
Type: text/x-patch
Size: 919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220303/300c75d7/attachment.bin>


More information about the libcxx-commits mailing list