This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Fix libstdc++/16020


Hi Benjamin, hi everyone,

the below is a  minimal fix for the PR: it just adds complete
definitions, as you did to fix _Error_formatter for -Weffc++.

Ok with you?

Tested x86-linux. Actually, it's a rather serious regression
for the debug mode in the release branch.

Paolo.

//////////
2004-06-18  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/16020
	* include/debug/safe_base.h
	(_Safe_sequence_base::_Safe_sequence_base(const _Safe_sequence_base&),
	_Safe_sequence_base::operator=): Provide definitions.
	* testsuite/23_containers/bitset/cons/16020.cc: New.
diff -urN libstdc++-v3-orig/include/debug/safe_base.h libstdc++-v3/include/debug/safe_base.h
--- libstdc++-v3-orig/include/debug/safe_base.h	2004-05-23 01:46:33.000000000 +0200
+++ libstdc++-v3/include/debug/safe_base.h	2004-06-18 13:17:55.000000000 +0200
@@ -165,10 +165,23 @@
     { }
 
     explicit
-    _Safe_sequence_base(const _Safe_sequence_base&);
+    _Safe_sequence_base(const _Safe_sequence_base& __seq)
+    : _M_iterators(__seq._M_iterators),
+      _M_const_iterators(__seq._M_const_iterators),
+      _M_version(__seq._M_version)
+    { }
 
     _Safe_sequence_base&
-    operator=(const _Safe_sequence_base&);
+    operator=(const _Safe_sequence_base& __seq)
+    {
+      if (&__seq != this)
+	{
+	  _M_iterators = __seq._M_iterators;
+	  _M_const_iterators = __seq._M_const_iterators;
+	  _M_version = __seq._M_version;
+	}
+      return *this;
+    }
 
     /** Notify all iterators that reference this sequence that the
 	sequence is being destroyed. */
diff -urN libstdc++-v3-orig/testsuite/23_containers/bitset/cons/16020.cc libstdc++-v3/testsuite/23_containers/bitset/cons/16020.cc
--- libstdc++-v3-orig/testsuite/23_containers/bitset/cons/16020.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/bitset/cons/16020.cc	2004-06-18 13:49:29.000000000 +0200
@@ -0,0 +1,42 @@
+// Copyright (C) 2004 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <debug/bitset>
+#include <testsuite_hooks.h>
+
+// libstdc++/16020
+void test01()
+{
+  using __gnu_debug::bitset;
+  bool test __attribute__((unused)) = true;
+
+  bitset<5> b(7);
+  bitset<5> c;
+
+  bitset<5> bb(b);
+  c = bb;
+
+  VERIFY( bb == b );
+  VERIFY( c == bb );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]