[libcxx] r178116 - Revert r178075, "Tighten up the iterator requirements ...", it breaks LLVM

Daniel Dunbar daniel at zuster.org
Tue Mar 26 21:10:25 PDT 2013


Author: ddunbar
Date: Tue Mar 26 23:10:25 2013
New Revision: 178116

URL: http://llvm.org/viewvc/llvm-project?rev=178116&view=rev
Log:
Revert r178075, "Tighten up the iterator requirements ...", it breaks LLVM
bootstrap with libc++.

Modified:
    libcxx/trunk/include/vector
    libcxx/trunk/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp

Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=178116&r1=178115&r2=178116&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Tue Mar 26 23:10:25 2013
@@ -526,29 +526,17 @@ public:
     template <class _InputIterator>
         vector(_InputIterator __first, _InputIterator __last,
                typename enable_if<__is_input_iterator  <_InputIterator>::value &&
-                                 !__is_forward_iterator<_InputIterator>::value &&
-                                 is_constructible<
-                                    value_type,
-                                    typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
+                                 !__is_forward_iterator<_InputIterator>::value>::type* = 0);
     template <class _InputIterator>
         vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
                typename enable_if<__is_input_iterator  <_InputIterator>::value &&
-                                 !__is_forward_iterator<_InputIterator>::value &&
-                                 is_constructible<
-                                    value_type,
-                                    typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
+                                 !__is_forward_iterator<_InputIterator>::value>::type* = 0);
     template <class _ForwardIterator>
         vector(_ForwardIterator __first, _ForwardIterator __last,
-               typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
-                                 is_constructible<
-                                    value_type,
-                                    typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
+               typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
     template <class _ForwardIterator>
         vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
-               typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
-                                 is_constructible<
-                                    value_type,
-                                    typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
+               typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
     _LIBCPP_INLINE_VISIBILITY
     vector(initializer_list<value_type> __il);
@@ -589,20 +577,14 @@ public:
         typename enable_if
         <
              __is_input_iterator  <_InputIterator>::value &&
-            !__is_forward_iterator<_InputIterator>::value &&
-            is_constructible<
-                 value_type,
-                 typename iterator_traits<_InputIterator>::reference>::value,
+            !__is_forward_iterator<_InputIterator>::value,
             void
         >::type
         assign(_InputIterator __first, _InputIterator __last);
     template <class _ForwardIterator>
         typename enable_if
         <
-            __is_forward_iterator<_ForwardIterator>::value &&
-            is_constructible<
-                 value_type,
-                 typename iterator_traits<_ForwardIterator>::reference>::value,
+            __is_forward_iterator<_ForwardIterator>::value,
             void
         >::type
         assign(_ForwardIterator __first, _ForwardIterator __last);
@@ -718,20 +700,14 @@ public:
         typename enable_if
         <
              __is_input_iterator  <_InputIterator>::value &&
-            !__is_forward_iterator<_InputIterator>::value &&
-            is_constructible<
-                 value_type,
-                 typename iterator_traits<_InputIterator>::reference>::value,
+            !__is_forward_iterator<_InputIterator>::value,
             iterator
         >::type
         insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
     template <class _ForwardIterator>
         typename enable_if
         <
-            __is_forward_iterator<_ForwardIterator>::value &&
-            is_constructible<
-                 value_type,
-                 typename iterator_traits<_ForwardIterator>::reference>::value,
+            __is_forward_iterator<_ForwardIterator>::value,
             iterator
         >::type
         insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
@@ -1058,10 +1034,7 @@ template <class _Tp, class _Allocator>
 template <class _InputIterator>
 vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
        typename enable_if<__is_input_iterator  <_InputIterator>::value &&
-                         !__is_forward_iterator<_InputIterator>::value &&
-                         is_constructible<
-                            value_type,
-                            typename iterator_traits<_InputIterator>::reference>::value>::type*)
+                         !__is_forward_iterator<_InputIterator>::value>::type*)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
     __get_db()->__insert_c(this);
@@ -1074,10 +1047,7 @@ template <class _Tp, class _Allocator>
 template <class _InputIterator>
 vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
        typename enable_if<__is_input_iterator  <_InputIterator>::value &&
-                         !__is_forward_iterator<_InputIterator>::value &&
-                         is_constructible<
-                            value_type,
-                            typename iterator_traits<_InputIterator>::reference>::value>::type*)
+                         !__is_forward_iterator<_InputIterator>::value>::type*)
     : __base(__a)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1090,10 +1060,7 @@ vector<_Tp, _Allocator>::vector(_InputIt
 template <class _Tp, class _Allocator>
 template <class _ForwardIterator>
 vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
-                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
-                                is_constructible<
-                                   value_type,
-                                   typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
+                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
     __get_db()->__insert_c(this);
@@ -1109,10 +1076,7 @@ vector<_Tp, _Allocator>::vector(_Forward
 template <class _Tp, class _Allocator>
 template <class _ForwardIterator>
 vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
-                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
-                                is_constructible<
-                                   value_type,
-                                   typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
+                                typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
     : __base(__a)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1294,10 +1258,7 @@ template <class _InputIterator>
 typename enable_if
 <
      __is_input_iterator  <_InputIterator>::value &&
-    !__is_forward_iterator<_InputIterator>::value &&
-    is_constructible<
-       _Tp,
-       typename iterator_traits<_InputIterator>::reference>::value,
+    !__is_forward_iterator<_InputIterator>::value,
     void
 >::type
 vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
@@ -1311,10 +1272,7 @@ template <class _Tp, class _Allocator>
 template <class _ForwardIterator>
 typename enable_if
 <
-    __is_forward_iterator<_ForwardIterator>::value &&
-    is_constructible<
-       _Tp,
-       typename iterator_traits<_ForwardIterator>::reference>::value,
+    __is_forward_iterator<_ForwardIterator>::value,
     void
 >::type
 vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
@@ -1795,10 +1753,7 @@ template <class _InputIterator>
 typename enable_if
 <
      __is_input_iterator  <_InputIterator>::value &&
-    !__is_forward_iterator<_InputIterator>::value &&
-    is_constructible<
-       _Tp,
-       typename iterator_traits<_InputIterator>::reference>::value,
+    !__is_forward_iterator<_InputIterator>::value,
     typename vector<_Tp, _Allocator>::iterator
 >::type
 vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
@@ -1850,10 +1805,7 @@ template <class _Tp, class _Allocator>
 template <class _ForwardIterator>
 typename enable_if
 <
-    __is_forward_iterator<_ForwardIterator>::value &&
-    is_constructible<
-       _Tp,
-       typename iterator_traits<_ForwardIterator>::reference>::value,
+    __is_forward_iterator<_ForwardIterator>::value,
     typename vector<_Tp, _Allocator>::iterator
 >::type
 vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)

Modified: libcxx/trunk/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp?rev=178116&r1=178115&r2=178116&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp Tue Mar 26 23:10:25 2013
@@ -28,10 +28,6 @@ test(Iterator first, Iterator last)
         assert(*i == *first);
 }
 
-struct X
-{
-};
-
 int main()
 {
     int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
@@ -47,7 +43,4 @@ int main()
     test<std::vector<int, stack_allocator<int, 18> > >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
     test<std::vector<int, stack_allocator<int, 18> > >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
     test<std::vector<int, stack_allocator<int, 18> > >(a, an);
-
-    X x[2];
-    static_assert(!(std::is_constructible<std::vector<int>, X*, X*>::value), "");
 }





More information about the cfe-commits mailing list