[libcxx-commits] [libcxx] r356140 - Properly constrain basic_string(Iter, Iter, Alloc = A())

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 14 05:31:10 PDT 2019


Author: ericwf
Date: Thu Mar 14 05:31:10 2019
New Revision: 356140

URL: http://llvm.org/viewvc/llvm-project?rev=356140&view=rev
Log:
Properly constrain basic_string(Iter, Iter, Alloc = A())

Modified:
    libcxx/trunk/include/string
    libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp

Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=356140&r1=356139&r2=356140&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Thu Mar 14 05:31:10 2019
@@ -862,10 +862,10 @@ public:
         _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
         explicit basic_string(const _Tp& __t, const allocator_type& __a);
 
-    template<class _InputIterator>
+    template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
         _LIBCPP_INLINE_VISIBILITY
         basic_string(_InputIterator __first, _InputIterator __last);
-    template<class _InputIterator>
+    template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
         _LIBCPP_INLINE_VISIBILITY
         basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
 #ifndef _LIBCPP_CXX03_LANG
@@ -2077,7 +2077,7 @@ basic_string<_CharT, _Traits, _Allocator
 }
 
 template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
+template<class _InputIterator, class>
 inline
 basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
 {
@@ -2088,7 +2088,7 @@ basic_string<_CharT, _Traits, _Allocator
 }
 
 template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
+template<class _InputIterator, class>
 inline
 basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
                                                         const allocator_type& __a)

Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp?rev=356140&r1=356139&r2=356140&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp Thu Mar 14 05:31:10 2019
@@ -116,6 +116,15 @@ int main(int, char**)
     test(input_iterator<const char*>(s), input_iterator<const char*>(s+50), A());
     }
 #endif
+    {
+      static_assert((!std::is_constructible<std::string, std::string,
+                                            std::string>::value),
+                    "");
+      static_assert(
+          (!std::is_constructible<std::string, std::string, std::string,
+                                  std::allocator<char> >::value),
+          "");
+    }
 
   return 0;
 }




More information about the libcxx-commits mailing list