+2018-07-03 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/debug/string
+ (__gnu_debug::basic_string<>::insert<_Ite>(const_iterator, _Ite, _Ite)):
+ Use __glibcxx_check_insert_range.
+ * 21_strings/basic_string/cons/char/1.cc: Adapt test to use
+ __gnu_debug::string when _GLIBCXX_DEBUG.
+ * 21_strings/basic_string/init-list.cc: Likewise.
+ * 21_strings/basic_string/modifiers/insert/char/1.cc: Likewise.
+ * 21_strings/basic_string/modifiers/insert/char/2.cc: Likewise.
+ * 21_strings/basic_string/modifiers/insert/char/83328.cc: Likewise.
+ * 21_strings/basic_string/types/1.cc: Likewise.
+
2018-07-04 Jonathan Wakely <jwakely@redhat.com>
* testsuite/25_algorithms/make_heap/complexity.cc: Require effective
: _Base(__str, __pos, __n, __a) { }
basic_string(const _CharT* __s, size_type __n,
- const _Allocator& __a = _Allocator())
+ const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__check_string(__s, __n), __n, __a) { }
basic_string(const _CharT* __s, const _Allocator& __a = _Allocator())
insert(const_iterator __p, _InputIterator __first, _InputIterator __last)
{
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
- __glibcxx_check_insert_range2(__p, __first, __last, __dist);
+ __glibcxx_check_insert_range(__p, __first, __last, __dist);
typename _Base::iterator __res;
if (__dist.second >= __dp_sign)
// 21.3.1 basic_string constructors.
#include <new>
-#include <string>
#include <stdexcept>
#include <testsuite_hooks.h>
+#ifdef _GLIBCXX_DEBUG
+# include <debug/string>
+using namespace __gnu_debug;
+#else
+# include <string>
+using namespace std;
+#endif
+
void test01(void)
{
- typedef std::string::size_type csize_type;
- typedef std::string::iterator citerator;
- csize_type npos = std::string::npos;
+ typedef string::size_type csize_type;
+ typedef string::iterator citerator;
+ csize_type npos = string::npos;
csize_type csz01;
const char str_lit01[] = "rodeo beach, marin";
- const std::string str01(str_lit01);
- const std::string str02("baker beach, san francisco");
+ const string str01(str_lit01);
+ const string str02("baker beach, san francisco");
// basic_string(const string&, size_type pos = 0, siz_type n = npos, alloc)
csz01 = str01.size();
try {
- std::string str03(str01, csz01 + 1);
+ string str03(str01, csz01 + 1);
VERIFY( false );
}
catch(std::out_of_range& fail) {
}
try {
- std::string str03(str01, csz01);
+ string str03(str01, csz01);
VERIFY( str03.size() == 0 );
VERIFY( str03.size() <= str03.capacity() );
}
// NB: As strlen(str_lit01) != csz01, this test is undefined. It
// should not crash, but what gets constructed is a bit arbitrary.
try {
- std::string str03(str_lit01, csz01 + 1);
+ string str03(str_lit01, csz01 + 1);
VERIFY( true );
}
catch(std::length_error& fail) {
// should not crash, but what gets constructed is a bit arbitrary.
// The "maverick's" of all string objects.
try {
- std::string str04(str_lit01, npos);
+ string str04(str_lit01, npos);
VERIFY( true );
}
catch(std::length_error& fail) {
// Build a maxsize - 1 lengthed string consisting of all A's
try {
- std::string str03(csz01 - 1, 'A');
+ string str03(csz01 - 1, 'A');
VERIFY( str03.size() == csz01 - 1 );
VERIFY( str03.size() <= str03.capacity() );
}
}
// basic_string(const char* s, const allocator& a = allocator())
- std::string str04(str_lit01);
+ string str04(str_lit01);
VERIFY( str01 == str04 );
// basic_string(size_type n, char c, const allocator& a = allocator())
csz01 = str01.max_size();
try {
- std::string str03(csz01 + 1, 'z');
+ string str03(csz01 + 1, 'z');
VERIFY( false );
}
catch(std::length_error& fail) {
}
try {
- std::string str04(npos, 'b'); // the "maverick's" of all string objects.
+ string str04(npos, 'b'); // the "maverick's" of all string objects.
VERIFY( false );
}
catch(std::length_error& fail) {
}
try {
- std::string str03(csz01 - 1, 'z');
+ string str03(csz01 - 1, 'z');
VERIFY( str03.size() != 0 );
VERIFY( str03.size() <= str03.capacity() );
}
VERIFY( false );
}
-
// template<typename _InputIter>
// basic_string(_InputIter begin, _InputIter end, const allocator& a)
- std::string str06(str01.begin(), str01.end());
+ string str06(str01.begin(), str01.end());
VERIFY( str06 == str01 );
}
// 21.3.5.4 basic_string::insert
-#include <string>
#include <stdexcept>
#include <testsuite_hooks.h>
+#ifdef _GLIBCXX_DEBUG
+#include <debug/string>
+using namespace __gnu_debug;
+#else
+#include <string>
+using namespace std;
+#endif
+
void test01(void)
{
- typedef std::string::size_type csize_type;
- typedef std::string::iterator citerator;
+ typedef string::size_type csize_type;
+ typedef string::iterator citerator;
csize_type csz01, csz02;
- const std::string str01("rodeo beach, marin");
- const std::string str02("baker beach, san francisco");
- std::string str03;
+ const string str01("rodeo beach, marin");
+ const string str02("baker beach, san francisco");
+ string str03;
// string& insert(size_type p1, const string& str, size_type p2, size_type n)
// requires:
csz01 = str01.max_size();
try {
- std::string str04(csz01, 'b');
+ string str04(csz01, 'b');
str03 = str04;
csz02 = str02.size();
try {