[libcxx] r280779 - Fix PR#30303 - no matching function for call to '__ptr_in_range'

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 20:32:07 PDT 2016


Author: marshall
Date: Tue Sep  6 22:32:06 2016
New Revision: 280779

URL: http://llvm.org/viewvc/llvm-project?rev=280779&view=rev
Log:
Fix PR#30303 - no matching function for call to '__ptr_in_range'

Modified:
    libcxx/trunk/include/string
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp

Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=280779&r1=280778&r2=280779&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Tue Sep  6 22:32:06 2016
@@ -2156,12 +2156,18 @@ basic_string<_CharT, _Traits, _Allocator
     return *this;
 }
 
-template <typename _Tp>
+template <class _Tp>
 bool __ptr_in_range (const _Tp* __p, const _Tp* __first, const _Tp* __last)
 {
     return __first <= __p && __p < __last;
 }
 
+template <class _Tp1, class _Tp2>
+bool __ptr_in_range (const _Tp1* __p, const _Tp2* __first, const _Tp2* __last)
+{
+    return false;
+}
+
 template <class _CharT, class _Traits, class _Allocator>
 template<class _ForwardIterator>
 typename enable_if

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp?rev=280779&r1=280778&r2=280779&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp Tue Sep  6 22:32:06 2016
@@ -195,4 +195,13 @@ int main()
 	assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
 	}
 
+	{ // test appending a different type
+    typedef std::string S;
+	const uint8_t p[] = "ABCD";
+
+	S s;
+	s.append(p, p + 4);
+	assert(s == "ABCD");
+	}
+
 }

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp?rev=280779&r1=280778&r2=280779&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp Tue Sep  6 22:32:06 2016
@@ -196,4 +196,13 @@ int main()
 	s_long.assign(s_long.begin() + 30, s_long.end());
 	assert(s_long == "nsectetur/");
 	}
+
+	{ // test assigning a different type
+    typedef std::string S;
+	const uint8_t p[] = "ABCD";
+
+	S s;
+	s.assign(p, p + 4);
+	assert(s == "ABCD");
+	}
 }

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp?rev=280779&r1=280778&r2=280779&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp Tue Sep  6 22:32:06 2016
@@ -186,4 +186,12 @@ int main()
 	assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
 	}
 
+	{ // test assigning a different type
+    typedef std::string S;
+	const uint8_t p[] = "ABCD";
+
+	S s;
+	s.insert(s.begin(), p, p + 4);
+	assert(s == "ABCD");
+	}
 }

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp?rev=280779&r1=280778&r2=280779&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp Tue Sep  6 22:32:06 2016
@@ -1023,4 +1023,18 @@ int main()
 	s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end());
 	assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
 	}
+
+	{ // test assigning a different type
+    typedef std::string S;
+	const uint8_t pc[] = "ABCD";
+	uint8_t        p[] = "EFGH";
+
+	S s;
+	s.replace(s.begin(), s.end(), pc, pc + 4);
+	assert(s == "ABCD");
+
+	s.clear();
+	s.replace(s.begin(), s.end(), p, p + 4);
+	assert(s == "EFGH");
+	}
 }




More information about the cfe-commits mailing list