OSDN Git Service

2002-06-04 Paolo Carlini <pcarlini@unitus.it>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Jun 2002 18:20:38 +0000 (18:20 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Jun 2002 18:20:38 +0000 (18:20 +0000)
    Gaby Dos Reis  <gdr@codesourcery.com>

* include/bits/basic_string.tcc
(basic_string::_S_construct(forward_iterator_tag):
Fix typo in null pointer check.
* testsuite/21_strings/ctor_copy_dtor.cc: Add test04.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54255 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.tcc
libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc

index d6987c4..e1ea9e1 100644 (file)
@@ -1,4 +1,12 @@
 2002-06-04  Paolo Carlini  <pcarlini@unitus.it>
+            Gaby Dos Reis  <gdr@codesourcery.com>
+
+       * include/bits/basic_string.tcc
+       (basic_string::_S_construct(forward_iterator_tag):
+       Fix typo in null pointer check.
+       * testsuite/21_strings/ctor_copy_dtor.cc: Add test04.
+
+2002-06-04  Paolo Carlini  <pcarlini@unitus.it>
 
        * testsuite/22_locale/money_get_members_char.cc
        (test02): Add decimal point to long double constants.
index 3f4b5fb..296d43a 100644 (file)
@@ -140,7 +140,7 @@ namespace std
        size_type __dnew = static_cast<size_type>(distance(__beg, __end));
 
        // NB: Not required, but considered best practice.
-       if (__builtin_expect(__beg == _InIter(0), 0))
+       if (__builtin_expect(__beg == _InIter(), 0))
          __throw_logic_error("attempt to create string with null pointer");
        
        if (__beg == __end && __a == _Alloc())
index 9247a99..ea22cfc 100644 (file)
@@ -201,11 +201,25 @@ void test03()
     }
 }
 
+// http://gcc.gnu.org/ml/libstdc++/2002-06/msg00025.html
+void test04()
+{
+  bool test = true;
+
+  std::string str01("portofino");
+
+  std::string::reverse_iterator i1 = str01.rbegin();
+  std::string::reverse_iterator i2 = str01.rend();
+  std::string str02(i1, i2);
+  VERIFY( str02 == "onifotrop" );
+}
+
 int main()
 { 
   __set_testsuite_memlimit();
   test01();
   test02();
   test03();
+  test04();
   return 0;
 }