[libcxx] r274209 - Fix ::reference typedef in insert iterators.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 21:40:50 PDT 2016


Author: ericwf
Date: Wed Jun 29 23:40:50 2016
New Revision: 274209

URL: http://llvm.org/viewvc/llvm-project?rev=274209&view=rev
Log:
Fix ::reference typedef in insert iterators.

Since at least the C++11 standard insert iterators are specified
as having ::reference typedef void. Libc++ was not doing that.
This patch corrects the typedef.

This patch changes the std::iterator base class of insert_iterator,
front_insert_iterator and back_insert_iterator. This should not
be an ABI breaking change.

Modified:
    libcxx/trunk/include/iterator
    libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
    libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
    libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp

Modified: libcxx/trunk/include/iterator
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=274209&r1=274208&r2=274209&view=diff
==============================================================================
--- libcxx/trunk/include/iterator (original)
+++ libcxx/trunk/include/iterator Wed Jun 29 23:40:50 2016
@@ -149,7 +149,7 @@ public:
     typedef Container                   container_type;
     typedef void                        value_type;
     typedef void                        difference_type;
-    typedef back_insert_iterator<Cont>& reference;
+    typedef void                        reference;
     typedef void                        pointer;
 
     explicit back_insert_iterator(Container& x);
@@ -170,7 +170,7 @@ public:
     typedef Container                    container_type;
     typedef void                         value_type;
     typedef void                         difference_type;
-    typedef front_insert_iterator<Cont>& reference;
+    typedef void                         reference;
     typedef void                         pointer;
 
     explicit front_insert_iterator(Container& x);
@@ -192,7 +192,7 @@ public:
     typedef Container              container_type;
     typedef void                   value_type;
     typedef void                   difference_type;
-    typedef insert_iterator<Cont>& reference;
+    typedef void                   reference;
     typedef void                   pointer;
 
     insert_iterator(Container& x, typename Container::iterator i);
@@ -663,7 +663,7 @@ class _LIBCPP_TYPE_VIS_ONLY back_insert_
                       void,
                       void,
                       void,
-                      back_insert_iterator<_Container>&>
+                      void>
 {
 protected:
     _Container* container;
@@ -696,7 +696,7 @@ class _LIBCPP_TYPE_VIS_ONLY front_insert
                       void,
                       void,
                       void,
-                      front_insert_iterator<_Container>&>
+                      void>
 {
 protected:
     _Container* container;
@@ -729,7 +729,7 @@ class _LIBCPP_TYPE_VIS_ONLY insert_itera
                       void,
                       void,
                       void,
-                      insert_iterator<_Container>&>
+                      void>
 {
 protected:
     _Container* container;

Modified: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp?rev=274209&r1=274208&r2=274209&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp Wed Jun 29 23:40:50 2016
@@ -21,7 +21,7 @@
 //   typedef Cont                        container_type;
 //   typedef void                        value_type;
 //   typedef void                        difference_type;
-//   typedef back_insert_iterator<Cont>& reference;
+//   typedef void                        reference;
 //   typedef void                        pointer;
 // };
 
@@ -48,7 +48,7 @@ test()
     static_assert((std::is_same<typename R::container_type, C>::value), "");
     static_assert((std::is_same<typename R::value_type, void>::value), "");
     static_assert((std::is_same<typename R::difference_type, void>::value), "");
-    static_assert((std::is_same<typename R::reference, R&>::value), "");
+    static_assert((std::is_same<typename R::reference, void>::value), "");
     static_assert((std::is_same<typename R::pointer, void>::value), "");
     static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
 }

Modified: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp?rev=274209&r1=274208&r2=274209&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp Wed Jun 29 23:40:50 2016
@@ -21,7 +21,7 @@
 //   typedef Container                   container_type;
 //   typedef void                        value_type;
 //   typedef void                        difference_type;
-//   typedef front_insert_iterator<Cont>& reference;
+//   typedef void                        reference;
 //   typedef void                        pointer;
 //   typedef output_iterator_tag         iterator_category;
 // };
@@ -49,7 +49,7 @@ test()
     static_assert((std::is_same<typename R::container_type, C>::value), "");
     static_assert((std::is_same<typename R::value_type, void>::value), "");
     static_assert((std::is_same<typename R::difference_type, void>::value), "");
-    static_assert((std::is_same<typename R::reference, R&>::value), "");
+    static_assert((std::is_same<typename R::reference, void>::value), "");
     static_assert((std::is_same<typename R::pointer, void>::value), "");
     static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
 }

Modified: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp?rev=274209&r1=274208&r2=274209&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp Wed Jun 29 23:40:50 2016
@@ -22,7 +22,7 @@
 //   typedef Cont                   container_type;
 //   typedef void                   value_type;
 //   typedef void                   difference_type;
-//   typedef insert_iterator<Cont>& reference;
+//   typedef void                   reference;
 //   typedef void                   pointer;
 // };
 
@@ -53,7 +53,7 @@ test()
     static_assert((std::is_same<typename R::container_type, C>::value), "");
     static_assert((std::is_same<typename R::value_type, void>::value), "");
     static_assert((std::is_same<typename R::difference_type, void>::value), "");
-    static_assert((std::is_same<typename R::reference, R&>::value), "");
+    static_assert((std::is_same<typename R::reference, void>::value), "");
     static_assert((std::is_same<typename R::pointer, void>::value), "");
     static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
 }




More information about the cfe-commits mailing list