This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] libstdc++/23781
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Sat, 10 Sep 2005 01:17:35 +0200
- Subject: [Patch] libstdc++/23781
Hi everyone,
the below is what I currently have for this issue, rather trivial, in
the substance, but unfortunately required tweaking a few more lines
(besides the constructors from pointer themselves), simply because we
were exploiting in the implementation the non-explicit-ness of the
constructors.
Regtesting is OK on x86-linux. Please have a look, I may well have
missed one or two bits. Otherwise, tomorrow I'd like to commit the patch.
Thanks,
Paolo.
////////////////
2005-09-10 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.
Index: include/bits/list.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/list.tcc,v
retrieving revision 1.21
diff -u -r1.21 list.tcc
--- include/bits/list.tcc 17 Aug 2005 02:12:52 -0000 1.21
+++ include/bits/list.tcc 9 Sep 2005 22:35:08 -0000
@@ -86,7 +86,7 @@
{
_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 @@
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;
}
Index: include/bits/stl_list.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_list.h,v
retrieving revision 1.51
diff -u -r1.51 stl_list.h
--- include/bits/stl_list.h 17 Aug 2005 02:13:01 -0000 1.51
+++ include/bits/stl_list.h 9 Sep 2005 22:35:08 -0000
@@ -122,6 +122,7 @@
_List_iterator()
: _M_node() { }
+ explicit
_List_iterator(_List_node_base* __x)
: _M_node(__x) { }
@@ -199,6 +200,7 @@
_List_const_iterator()
: _M_node() { }
+ explicit
_List_const_iterator(const _List_node_base* __x)
: _M_node(__x) { }
@@ -574,7 +576,7 @@
*/
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 @@
*/
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 @@
* 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 @@
*/
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 @@
*/
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.
Index: include/bits/stl_tree.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_tree.h,v
retrieving revision 1.47
diff -u -r1.47 stl_tree.h
--- include/bits/stl_tree.h 17 Aug 2005 02:13:02 -0000 1.47
+++ include/bits/stl_tree.h 9 Sep 2005 22:35:08 -0000
@@ -164,6 +164,7 @@
_Rb_tree_iterator()
: _M_node() { }
+ explicit
_Rb_tree_iterator(_Link_type __x)
: _M_node(__x) { }
@@ -235,6 +236,7 @@
_Rb_tree_const_iterator()
: _M_node() { }
+ explicit
_Rb_tree_const_iterator(_Link_type __x)
: _M_node(__x) { }
@@ -579,22 +581,28 @@
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 @@
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);
Index: include/ext/slist
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/slist,v
retrieving revision 1.27
diff -u -r1.27 slist
--- include/ext/slist 17 Aug 2005 02:13:21 -0000 1.27
+++ include/ext/slist 9 Sep 2005 22:35:08 -0000
@@ -190,6 +190,7 @@
typedef _Ref reference;
typedef _Slist_node<_Tp> _Node;
+ explicit
_Slist_iterator(_Node* __x)
: _Slist_iterator_base(__x) {}
@@ -601,20 +602,26 @@
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);
Index: include/tr1/array
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/tr1/array,v
retrieving revision 1.7
diff -u -r1.7 array
--- include/tr1/array 26 Aug 2005 15:52:52 -0000 1.7
+++ include/tr1/array 9 Sep 2005 22:35:08 -0000
@@ -75,21 +75,21 @@
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()
Index: include/tr1/hashtable
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/tr1/hashtable,v
retrieving revision 1.8
diff -u -r1.8 hashtable
--- include/tr1/hashtable 25 Aug 2005 09:34:49 -0000 1.8
+++ include/tr1/hashtable 9 Sep 2005 22:35:09 -0000
@@ -261,7 +261,8 @@
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) { }
Index: testsuite/23_containers/list/23781.cc
===================================================================
RCS file: testsuite/23_containers/list/23781.cc
diff -N testsuite/23_containers/list/23781.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/23_containers/list/23781.cc 9 Sep 2005 22:35:09 -0000
@@ -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" }
Index: testsuite/23_containers/map/23781.cc
===================================================================
RCS file: testsuite/23_containers/map/23781.cc
diff -N testsuite/23_containers/map/23781.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/23_containers/map/23781.cc 9 Sep 2005 22:35:09 -0000
@@ -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" }
Index: testsuite/23_containers/map/operators/1_neg.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc,v
retrieving revision 1.7
diff -u -r1.7 1_neg.cc
--- testsuite/23_containers/map/operators/1_neg.cc 17 Aug 2005 02:18:38 -0000 1.7
+++ testsuite/23_containers/map/operators/1_neg.cc 9 Sep 2005 22:35:09 -0000
@@ -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 @@
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 }
Index: testsuite/23_containers/multimap/23781.cc
===================================================================
RCS file: testsuite/23_containers/multimap/23781.cc
diff -N testsuite/23_containers/multimap/23781.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/23_containers/multimap/23781.cc 9 Sep 2005 22:35:09 -0000
@@ -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" }
Index: testsuite/23_containers/multiset/23781.cc
===================================================================
RCS file: testsuite/23_containers/multiset/23781.cc
diff -N testsuite/23_containers/multiset/23781.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/23_containers/multiset/23781.cc 9 Sep 2005 22:35:09 -0000
@@ -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" }
Index: testsuite/23_containers/set/23781.cc
===================================================================
RCS file: testsuite/23_containers/set/23781.cc
diff -N testsuite/23_containers/set/23781.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/23_containers/set/23781.cc 9 Sep 2005 22:35:09 -0000
@@ -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" }
Index: testsuite/23_containers/set/operators/1_neg.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc,v
retrieving revision 1.7
diff -u -r1.7 1_neg.cc
--- testsuite/23_containers/set/operators/1_neg.cc 17 Aug 2005 02:18:58 -0000 1.7
+++ testsuite/23_containers/set/operators/1_neg.cc 9 Sep 2005 22:35:09 -0000
@@ -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 @@
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 }
Index: testsuite/ext/slist/23781.cc
===================================================================
RCS file: testsuite/ext/slist/23781.cc
diff -N testsuite/ext/slist/23781.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/ext/slist/23781.cc 9 Sep 2005 22:35:10 -0000
@@ -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" }
Index: testsuite/tr1/6_containers/unordered/23781.cc
===================================================================
RCS file: testsuite/tr1/6_containers/unordered/23781.cc
diff -N testsuite/tr1/6_containers/unordered/23781.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/tr1/6_containers/unordered/23781.cc 9 Sep 2005 22:35:11 -0000
@@ -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" }