[PATCH] D52260: Fix DenseSet::ConstIterator typedefs

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 20 16:15:00 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342697: Fix DenseSet::ConstIterator typedefs (authored by dblaikie, committed by ).
Herald added a subscriber: kristina.

Changed prior to commit:
  https://reviews.llvm.org/D52260?vs=166071&id=166380#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52260

Files:
  llvm/trunk/include/llvm/ADT/DenseSet.h
  llvm/trunk/unittests/ADT/DenseSetTest.cpp


Index: llvm/trunk/unittests/ADT/DenseSetTest.cpp
===================================================================
--- llvm/trunk/unittests/ADT/DenseSetTest.cpp
+++ llvm/trunk/unittests/ADT/DenseSetTest.cpp
@@ -15,6 +15,13 @@
 
 namespace {
 
+static_assert(std::is_const<std::remove_pointer<
+                  DenseSet<int>::const_iterator::pointer>::type>::value,
+              "Iterator pointer type should be const");
+static_assert(std::is_const<std::remove_reference<
+                  DenseSet<int>::const_iterator::reference>::type>::value,
+              "Iterator reference type should be const");
+
 // Test hashing with a set of only two entries.
 TEST(DenseSetTest, DoubleEntrySetTest) {
   llvm::DenseSet<unsigned> set(2);
Index: llvm/trunk/include/llvm/ADT/DenseSet.h
===================================================================
--- llvm/trunk/include/llvm/ADT/DenseSet.h
+++ llvm/trunk/include/llvm/ADT/DenseSet.h
@@ -136,8 +136,8 @@
   public:
     using difference_type = typename MapTy::const_iterator::difference_type;
     using value_type = ValueT;
-    using pointer = value_type *;
-    using reference = value_type &;
+    using pointer = const value_type *;
+    using reference = const value_type &;
     using iterator_category = std::forward_iterator_tag;
 
     ConstIterator() = default;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52260.166380.patch
Type: text/x-patch
Size: 1331 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180920/525f318c/attachment.bin>


More information about the llvm-commits mailing list