2002-06-04 Paolo Carlini <pcarlini@unitus.it>
authorPaolo Carlini <pcarlini@unitus.it>
Tue, 4 Jun 2002 18:20:38 +0000 (20:20 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
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.

Co-Authored-By: Gabriel Dos Reis <gdr@codesourcery.com>
From-SVN: r54255

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

index d6987c498f79a24f2890e5d886195db7601adcfe..e1ea9e1e65ab1f52d8bb5cbe85fc954d334cf3cf 100644 (file)
@@ -1,3 +1,11 @@
+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
index 3f4b5fb73cac7e8480a707c99987938889bde48f..296d43ab1d92654fc2e010bbfa3e1ce346c9c8d8 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 9247a9904b8d3eabd6182b31dd45ab155c2b5664..ea22cfc2aa2f3e8432625d6c5e6e34cf3e08892d 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;
 }