[libcxx-commits] [PATCH] D116346: [libc++] Fix bug #52902

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 28 15:50:36 PST 2021


philnik created this revision.
philnik added reviewers: Quuxplusone, Mordante.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This fixes https://github.com/llvm/llvm-project/issues/52902. In debug mode during constant evaluation the iterator was never assigend. There seem to be no other instances of this bug.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116346

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
@@ -69,9 +69,10 @@
     _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
     __wrap_iter& operator=(const __wrap_iter& __x)
     {
-        if (this != _VSTD::addressof(__x) && !__libcpp_is_constant_evaluated())
+        if (this != _VSTD::addressof(__x))
         {
-            __get_db()->__iterator_copy(this, _VSTD::addressof(__x));
+            if (!__libcpp_is_constant_evaluated())
+                __get_db()->__iterator_copy(this, _VSTD::addressof(__x));
             __i = __x.__i;
         }
         return *this;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116346.396439.patch
Type: text/x-patch
Size: 728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211228/671feb18/attachment.bin>


More information about the libcxx-commits mailing list