[PATCH] D134675: [ADT] Make mapped_iterator copy assignable

James Player via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 16:55:22 PDT 2023


jplayer-nv added inline comments.


================
Comment at: llvm/unittests/ADT/MappedIteratorTest.cpp:177
+
+    EXPECT_EQ(I2, I1) << "move assigned iterator is a different position";
+  }
----------------
nickdesaulniers wrote:
> When I configure with `-DLLVM_ENABLE_EXPENSIVE_CHECKS=ON`, build this test with `ninja ADTTests` then run this, I get the following crash from this statement:
> ```
> /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/debug/safe_iterator.h:472:
> In function:
>     bool gnu_debug::operator==(const _Self &, const _Self &)
> 
> Error: attempt to compare a singular iterator to a 
> dereferenceable (start-of-sequence) iterator.
> 
> Objects involved in the operation:
>     iterator "lhs" @ 0x7ffcc2f77420 {
>       state = singular;
>     }
>     iterator "rhs" @ 0x7ffcc2f77450 {
>       state = dereferenceable (start-of-sequence);
>       references sequence @ 0x7ffcc2f772f0
>     }
> ```
> Any ideas how best to fix this?
I think this line is a mistake.  It should be:
```
EXPECT_EQ(I3, I1);
```
The test is currently reading a moved-from object (`I2`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134675/new/

https://reviews.llvm.org/D134675



More information about the llvm-commits mailing list