[PATCH] D144834: [ADT] Fix const-correctness issues in `zippy`

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 17:08:30 PST 2023


dblaikie added inline comments.


================
Comment at: llvm/unittests/ADT/IteratorTest.cpp:452-455
+    EXPECT_TRUE(IsConstRef(a));
+    EXPECT_FALSE(IsConstRef(b));
+    EXPECT_TRUE(IsConstRef(c));
+    EXPECT_FALSE(IsConstRef(d));
----------------
These could be static_asserts instead, perhaps? (similarly below)


================
Comment at: llvm/unittests/ADT/IteratorTest.cpp:501-502
+  unsigned iters = 0;
+  for (auto [a, b, c] : zip_equal(SmallVector<int>{1, 2, 3}, std::string("abc"),
+                                  std::vector<bool>{true, false, true})) {
+    a = 3;
----------------
Does this code work? How? Wouldn't the lifetimes of the temporary ranges expire before the body of the loop runs?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144834



More information about the llvm-commits mailing list