[PATCH] D113158: ADT: Fix const-correctness of iterator adaptors

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 17:45:44 PDT 2021


dexonsmith added inline comments.


================
Comment at: llvm/unittests/ADT/IteratorTest.cpp:104
+  EXPECT_EQ(true, canAssignFromInt(*I));    // int *
+  EXPECT_EQ(true, canAssignFromInt(*IC));   // int *const
+  EXPECT_EQ(false, canAssignFromInt(*CI));  // const int *
----------------
I expected this test to fail (and the proof below not to compile) after https://reviews.llvm.org/D112981, but locally it seemed fine. It appears that `const ReferenceT` is equivalent to `int&` when `ReferenceT==int&`... which confuses me a bit, but so be it.


================
Comment at: llvm/unittests/ADT/IteratorTest.cpp:124
+  EXPECT_EQ(true, canAssignFromInt(*P));    // int *
+  EXPECT_EQ(true, canAssignFromInt(*PC));   // int *const
+  EXPECT_EQ(false, canAssignFromInt(*CP));  // const int *
----------------
This returned `false` after https://reviews.llvm.org/D112981 and the proof below failed to compile.


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

https://reviews.llvm.org/D113158



More information about the llvm-commits mailing list