From e182017e46105b6dc5d9a1f399a03eaf26d30016 Mon Sep 17 00:00:00 2001
From: Paolo Carlini <pcarlini@suse.de>
Date: Sun, 11 Sep 2005 09:48:41 +0000
Subject: [PATCH] re PR libstdc++/23781 (Implicit conversion from NULL to
 list<T>::iterator)

2005-09-11  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/23781
	* include/bits/stl_list.h (_List_iterator<>::
	_List_iterator(_List_node_base*), _List_const_iterator<>::
	_List_const_iterator(const _List_node_base*)): Make explicit.
	(list<>::begin(), list<>::end(), list<>::pop_back()): Adjust
	consistently.
	* include/bits/list.tcc (list<>::insert, list<>::erase): Adjust
	consistently.
	* include/bits/stl_tree.h (_Rb_tree_iterator<>::
	_Rb_tree_iterator(_Link_type), _Rb_tree_const_iterator<>::
	_Rb_tree_const_iterator(_Link_type)): Make explicit.
	(_Rb_tree<>::begin(), _Rb_tree<>::end()): Adjust consistently.
	* include/ext/slist (_Slist_iterator<>::_Slist_iterator(_Node*)):
	Make explicit.
	(slist<>::erase(iterator), slist<>::erase(iterator, iterator)):
	Adjust consistently.
	* include/tr1/hashtable (hashtable_iterator<>::
	hashtable_iterator(hash_node<>**)): Make explicit.
	* testsuite/23_containers/list/23781.cc: New.
	* testsuite/23_containers/map/23781.cc: Likewise.
	* testsuite/23_containers/multimap/23781.cc: Likewise.
	* testsuite/23_containers/multiset/23781.cc: Likewise.
	* testsuite/23_containers/set/23781.cc: Likewise.
	* testsuite/ext/slist/23781.cc: Likewise.
	* testsuite/tr1/6_containers/unordered/23781.cc: Likewise.
	* testsuite/23_containers/map/operators/1_neg.cc: Adjust dg-error
	line numbers.
	* testsuite/23_containers/set/operators/1_neg.cc: Likewise.

	* include/tr1/array (array<>::begin(), array<>::end()): Adjust
	stylistically for consistency with the other containers.

From-SVN: r104139
---
 libstdc++-v3/ChangeLog                        | 34 +++++++++++++++
 libstdc++-v3/include/bits/list.tcc            |  4 +-
 libstdc++-v3/include/bits/stl_list.h          | 13 +++---
 libstdc++-v3/include/bits/stl_tree.h          | 28 +++++++-----
 libstdc++-v3/include/ext/slist                | 23 ++++++----
 libstdc++-v3/include/tr1/array                | 16 +++----
 libstdc++-v3/include/tr1/hashtable            |  3 +-
 .../testsuite/23_containers/list/23781.cc     | 36 ++++++++++++++++
 .../testsuite/23_containers/map/23781.cc      | 36 ++++++++++++++++
 .../23_containers/map/operators/1_neg.cc      |  6 +--
 .../testsuite/23_containers/multimap/23781.cc | 36 ++++++++++++++++
 .../testsuite/23_containers/multiset/23781.cc | 36 ++++++++++++++++
 .../testsuite/23_containers/set/23781.cc      | 36 ++++++++++++++++
 .../23_containers/set/operators/1_neg.cc      |  6 +--
 libstdc++-v3/testsuite/ext/slist/23781.cc     | 36 ++++++++++++++++
 .../tr1/6_containers/unordered/23781.cc       | 43 +++++++++++++++++++
 16 files changed, 352 insertions(+), 40 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/23_containers/list/23781.cc
 create mode 100644 libstdc++-v3/testsuite/23_containers/map/23781.cc
 create mode 100644 libstdc++-v3/testsuite/23_containers/multimap/23781.cc
 create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/23781.cc
 create mode 100644 libstdc++-v3/testsuite/23_containers/set/23781.cc
 create mode 100644 libstdc++-v3/testsuite/ext/slist/23781.cc
 create mode 100644 libstdc++-v3/testsuite/tr1/6_containers/unordered/23781.cc

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 9b3c14e880d0..ad1fb5d54131 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,37 @@
+2005-09-11  Paolo Carlini  <pcarlini@suse.de>
+
+	PR libstdc++/23781
+	* include/bits/stl_list.h (_List_iterator<>::
+	_List_iterator(_List_node_base*), _List_const_iterator<>::
+	_List_const_iterator(const _List_node_base*)): Make explicit.
+	(list<>::begin(), list<>::end(), list<>::pop_back()): Adjust
+	consistently.
+	* include/bits/list.tcc (list<>::insert, list<>::erase): Adjust
+	consistently.
+	* include/bits/stl_tree.h (_Rb_tree_iterator<>::
+	_Rb_tree_iterator(_Link_type), _Rb_tree_const_iterator<>::
+	_Rb_tree_const_iterator(_Link_type)): Make explicit.
+	(_Rb_tree<>::begin(), _Rb_tree<>::end()): Adjust consistently.
+	* include/ext/slist (_Slist_iterator<>::_Slist_iterator(_Node*)):
+	Make explicit.
+	(slist<>::erase(iterator), slist<>::erase(iterator, iterator)):
+	Adjust consistently.
+	* include/tr1/hashtable (hashtable_iterator<>::
+	hashtable_iterator(hash_node<>**)): Make explicit.
+	* testsuite/23_containers/list/23781.cc: New.
+	* testsuite/23_containers/map/23781.cc: Likewise.
+	* testsuite/23_containers/multimap/23781.cc: Likewise.
+	* testsuite/23_containers/multiset/23781.cc: Likewise.
+	* testsuite/23_containers/set/23781.cc: Likewise.
+	* testsuite/ext/slist/23781.cc: Likewise.
+	* testsuite/tr1/6_containers/unordered/23781.cc: Likewise.
+	* testsuite/23_containers/map/operators/1_neg.cc: Adjust dg-error
+	line numbers.
+	* testsuite/23_containers/set/operators/1_neg.cc: Likewise.
+
+	* include/tr1/array (array<>::begin(), array<>::end()): Adjust
+	stylistically for consistency with the other containers.
+
 2005-09-10  Joseph S. Myers  <joseph@codesourcery.com>
 
 	* testsuite/26_numerics/cmath/c99_classification_macros_c.cc:
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index 088a2ea86d80..ece04300f319 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -86,7 +86,7 @@ namespace _GLIBCXX_STD
     {
       _Node* __tmp = _M_create_node(__x);
       __tmp->hook(__position._M_node);
-      return __tmp;
+      return iterator(__tmp);
     }
 
   template<typename _Tp, typename _Alloc>
@@ -94,7 +94,7 @@ namespace _GLIBCXX_STD
     list<_Tp, _Alloc>::
     erase(iterator __position)
     {
-      iterator __ret = __position._M_node->_M_next;
+      iterator __ret = iterator(__position._M_node->_M_next);
       _M_erase(__position);
       return __ret;
     }
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index ba9a3d0d8cb8..6aa67fe55fd8 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -122,6 +122,7 @@ namespace _GLIBCXX_STD
       _List_iterator()
       : _M_node() { }
 
+      explicit
       _List_iterator(_List_node_base* __x)
       : _M_node(__x) { }
 
@@ -199,6 +200,7 @@ namespace _GLIBCXX_STD
       _List_const_iterator()
       : _M_node() { }
 
+      explicit
       _List_const_iterator(const _List_node_base* __x)
       : _M_node(__x) { }
 
@@ -574,7 +576,7 @@ namespace _GLIBCXX_STD
        */
       iterator
       begin()
-      { return this->_M_impl._M_node._M_next; }
+      { return iterator(this->_M_impl._M_node._M_next); }
 
       /**
        *  Returns a read-only (constant) iterator that points to the
@@ -583,7 +585,7 @@ namespace _GLIBCXX_STD
        */
       const_iterator
       begin() const
-      { return this->_M_impl._M_node._M_next; }
+      { return const_iterator(this->_M_impl._M_node._M_next); }
 
       /**
        *  Returns a read/write iterator that points one past the last
@@ -591,7 +593,8 @@ namespace _GLIBCXX_STD
        *  order.
        */
       iterator
-      end() { return &this->_M_impl._M_node; }
+      end()
+      { return iterator(&this->_M_impl._M_node); }
 
       /**
        *  Returns a read-only (constant) iterator that points one past
@@ -600,7 +603,7 @@ namespace _GLIBCXX_STD
        */
       const_iterator
       end() const
-      { return &this->_M_impl._M_node; }
+      { return const_iterator(&this->_M_impl._M_node); }
 
       /**
        *  Returns a read/write reverse iterator that points to the last
@@ -769,7 +772,7 @@ namespace _GLIBCXX_STD
        */
       void
       pop_back()
-      { this->_M_erase(this->_M_impl._M_node._M_prev); }
+      { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
 
       /**
        *  @brief  Inserts given value into %list before specified iterator.
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 756b5cdc06ad..fab8117edbe4 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -164,6 +164,7 @@ namespace std
       _Rb_tree_iterator()
       : _M_node() { }
 
+      explicit
       _Rb_tree_iterator(_Link_type __x)
       : _M_node(__x) { }
 
@@ -235,6 +236,7 @@ namespace std
       _Rb_tree_const_iterator()
       : _M_node() { }
 
+      explicit
       _Rb_tree_const_iterator(_Link_type __x)
       : _M_node(__x) { }
 
@@ -579,22 +581,28 @@ namespace std
 
       iterator
       begin()
-      { return static_cast<_Link_type>(this->_M_impl._M_header._M_left); }
+      { 
+	return iterator(static_cast<_Link_type>
+			(this->_M_impl._M_header._M_left));
+      }
 
       const_iterator
       begin() const
-      {
-	return static_cast<_Const_Link_type>
-	  (this->_M_impl._M_header._M_left);
+      { 
+	return const_iterator(static_cast<_Const_Link_type>
+			      (this->_M_impl._M_header._M_left));
       }
 
       iterator
       end()
-      { return static_cast<_Link_type>(&this->_M_impl._M_header); }
+      { return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); }
 
       const_iterator
       end() const
-      { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }
+      { 
+	return const_iterator(static_cast<_Const_Link_type>
+			      (&this->_M_impl._M_header));
+      }
 
       reverse_iterator
       rbegin()
@@ -641,12 +649,12 @@ namespace std
       insert_equal(iterator __position, const value_type& __x);
 
       template<typename _InputIterator>
-      void
-      insert_unique(_InputIterator __first, _InputIterator __last);
+        void
+        insert_unique(_InputIterator __first, _InputIterator __last);
 
       template<typename _InputIterator>
-      void
-      insert_equal(_InputIterator __first, _InputIterator __last);
+        void
+        insert_equal(_InputIterator __first, _InputIterator __last);
 
       void
       erase(iterator __position);
diff --git a/libstdc++-v3/include/ext/slist b/libstdc++-v3/include/ext/slist
index 1c2421fb2ac2..49ce77ea6ea8 100644
--- a/libstdc++-v3/include/ext/slist
+++ b/libstdc++-v3/include/ext/slist
@@ -190,6 +190,7 @@ namespace __gnu_cxx
       typedef _Ref             reference;
       typedef _Slist_node<_Tp> _Node;
 
+      explicit
       _Slist_iterator(_Node* __x)
       : _Slist_iterator_base(__x) {}
 
@@ -601,20 +602,26 @@ namespace __gnu_cxx
 
       iterator
       erase_after(iterator __before_first, iterator __last)
-      { return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
-						      __last._M_node)); }
+      { 
+	return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
+						      __last._M_node));
+      }
 
       iterator
       erase(iterator __pos)
-      { return (_Node*) this->_M_erase_after(__slist_previous(&this->_M_head,
-							      __pos._M_node)); }
+      { 
+	return iterator((_Node*) this->_M_erase_after
+			(__slist_previous(&this->_M_head, __pos._M_node)));
+      }
 
       iterator
       erase(iterator __first, iterator __last)
-      { return (_Node*) this->_M_erase_after(__slist_previous(&this->_M_head,
-							      __first._M_node),
-					     __last._M_node); }
-
+      { 
+	return iterator((_Node*) this->_M_erase_after
+			(__slist_previous(&this->_M_head, __first._M_node),
+			 __last._M_node));
+      }
+      
       void
       resize(size_type new_size, const _Tp& __x);
 
diff --git a/libstdc++-v3/include/tr1/array b/libstdc++-v3/include/tr1/array
index 4b500fc48a21..096df4f48ace 100644
--- a/libstdc++-v3/include/tr1/array
+++ b/libstdc++-v3/include/tr1/array
@@ -75,21 +75,21 @@ namespace tr1
       swap(array&);
 
       // Iterators.
-      iterator 
+      iterator
       begin()
-      { return &_M_instance[0]; }
+      { return iterator(&_M_instance[0]); }
 
-      const_iterator 
+      const_iterator
       begin() const 
-      { return &_M_instance[0]; }
+      { return const_iterator(&_M_instance[0]); }
 
-      iterator 
+      iterator
       end() 
-      { return &_M_instance[_Nm]; }
+      { return iterator(&_M_instance[_Nm]); }
 
-      const_iterator 
+      const_iterator
       end() const
-      { return &_M_instance[_Nm]; }
+      { return const_iterator(&_M_instance[_Nm]); }
 
       reverse_iterator 
       rbegin()
diff --git a/libstdc++-v3/include/tr1/hashtable b/libstdc++-v3/include/tr1/hashtable
index af43da2814f7..790e7e304270 100644
--- a/libstdc++-v3/include/tr1/hashtable
+++ b/libstdc++-v3/include/tr1/hashtable
@@ -261,7 +261,8 @@ namespace Internal
       hashtable_iterator(hash_node<Value, cache>* p,
 			 hash_node<Value, cache>** b)
       : hashtable_iterator_base<Value, cache>(p, b) { }
-  
+
+      explicit
       hashtable_iterator(hash_node<Value, cache>** b)
       : hashtable_iterator_base<Value, cache>(*b, b) { }
   
diff --git a/libstdc++-v3/testsuite/23_containers/list/23781.cc b/libstdc++-v3/testsuite/23_containers/list/23781.cc
new file mode 100644
index 000000000000..e91536ad1d57
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/23781.cc
@@ -0,0 +1,36 @@
+// 2005-09-10  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <list>
+
+std::list<int>::iterator it = NULL; // { dg-error "conversion" }
+std::list<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/map/23781.cc b/libstdc++-v3/testsuite/23_containers/map/23781.cc
new file mode 100644
index 000000000000..ddd92900ab6c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/23781.cc
@@ -0,0 +1,36 @@
+// 2005-09-10  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <map>
+
+std::map<int, int>::iterator it = NULL; // { dg-error "conversion" }
+std::map<int, int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc
index dad06f3435c4..405f8e4caa7d 100644
--- a/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2004, 2005 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
@@ -41,5 +41,5 @@ void test01()
   test &= itr == mapByName.end(); // { dg-error "no" } 
 }
  
-// { dg-error "candidates are" "" { target *-*-* } 209 }
-// { dg-error "candidates are" "" { target *-*-* } 213 }
+// { dg-error "candidates are" "" { target *-*-* } 210 }
+// { dg-error "candidates are" "" { target *-*-* } 214 }
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/23781.cc b/libstdc++-v3/testsuite/23_containers/multimap/23781.cc
new file mode 100644
index 000000000000..06ef245aa5f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/23781.cc
@@ -0,0 +1,36 @@
+// 2005-09-10  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <map>
+
+std::multimap<int, int>::iterator it = NULL; // { dg-error "conversion" }
+std::multimap<int, int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/23781.cc b/libstdc++-v3/testsuite/23_containers/multiset/23781.cc
new file mode 100644
index 000000000000..197c87079202
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/23781.cc
@@ -0,0 +1,36 @@
+// 2005-09-10  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <set>
+
+std::multiset<int>::iterator it = NULL; // { dg-error "conversion" }
+std::multiset<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/set/23781.cc b/libstdc++-v3/testsuite/23_containers/set/23781.cc
new file mode 100644
index 000000000000..54d689c83000
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/23781.cc
@@ -0,0 +1,36 @@
+// 2005-09-10  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <set>
+
+std::set<int>::iterator it = NULL; // { dg-error "conversion" }
+std::set<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc
index c88b977cc524..a0286b0566d9 100644
--- a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2004, 2005 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
@@ -39,5 +39,5 @@ void test01()
   test &= itr == setByName.end(); // { dg-error "no" } 
 }
 
-// { dg-error "candidates are" "" { target *-*-* } 283 }
-// { dg-error "candidates are" "" { target *-*-* } 287 }
+// { dg-error "candidates are" "" { target *-*-* } 285 }
+// { dg-error "candidates are" "" { target *-*-* } 289 }
diff --git a/libstdc++-v3/testsuite/ext/slist/23781.cc b/libstdc++-v3/testsuite/ext/slist/23781.cc
new file mode 100644
index 000000000000..7ec332bd97d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/slist/23781.cc
@@ -0,0 +1,36 @@
+// 2005-09-10  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <ext/slist>
+
+__gnu_cxx::slist<int>::iterator it = NULL; // { dg-error "conversion" }
+__gnu_cxx::slist<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/23781.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/23781.cc
new file mode 100644
index 000000000000..a54799323150
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/23781.cc
@@ -0,0 +1,43 @@
+// 2005-09-10  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <tr1/unordered_map>
+#include <tr1/unordered_set>
+
+std::tr1::unordered_map<int, int>::iterator it1 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_map<int, int>::const_iterator cit1 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_multimap<int, int>::iterator it2 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_multimap<int, int>::const_iterator cit2 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_multiset<int>::iterator it3 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_multiset<int>::const_iterator cit3 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_set<int>::iterator it4 = NULL; // { dg-error "conversion" }
+std::tr1::unordered_set<int>::const_iterator cit4 = NULL; // { dg-error "conversion" }
-- 
GitLab