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] | |
Here is an attempt at a patch to fix the rvalref ambiguities. I decided to change the constructors as well as the operator=. The constructors weren't causing a problem with this testcase, as there are already at least 2 standard-supplied constructors for each container (one taking the container, one taking an allocator). However templating them might stop other problems later. If someone with more template-foo than me thinks it would be safer to leave them as-is, I'm happy to change them back. Johnathan: I assume you a) have no problems with being put on the changelog, and b) I referenced you correctly? I think the new error message is OK (or at least as OK as error messages in the STL ever get...) The error message has changed from (for assigning an rvalue of a list to a vector say) t.cc:10: error: no match for 'operator=' in 'a = __gnu_cxx::__move [with _Tp = std::list<int, std::allocator<int> >](((std::list<int, std::allocator<int> >&)(& b)))' /gcccvs/lib/gcc/powerpc-apple-darwin8.1.0/4.1.0/../../../../include/c++/4.1.0/bits/vector.tcc:133: note: candidates are: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int, _Alloc = std::allocator<int>] /gcccvs/lib/gcc/powerpc-apple-darwin8.1.0/4.1.0/../../../../include/c++/4.1.0/bits/stl_vector.h:303: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(__gnu_cxx::__rvalref<std::vector<_Tp, _Alloc> >) [with _Tp = int, _Alloc = std::allocator<int>] to: /cleangcc/lib/gcc/powerpc-apple-darwin8.1.0/4.1.0/../../../../include/c++/4.1.0/bits/stl_vector.h: In member function 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(__gnu_cxx::__rvalref<_Vector>) [with _Vector = std::list<int, std::allocator<int> >, _Tp = int, _Alloc = std::allocator<int>]': t.cc:10: instantiated from here /cleangcc/lib/gcc/powerpc-apple-darwin8.1.0/4.1.0/../../../../include/c++/4.1.0/bits/stl_vector.h:313: error: no matching function for call to 'std::vector<int, std::allocator<int> >::swap(std::list<int, std::allocator<int> >&)' /cleangcc/lib/gcc/powerpc-apple-darwin8.1.0/4.1.0/../../../../include/c++/4.1.0/bits/stl_vector.h:748: note: candidates are: void std::vector<_Tp, _Alloc>::swap(std::vector<_Tp, _Alloc>&) [with _Tp = int, _Alloc = std::allocator<int>]
Attachment:
Changelog-rvalref
Description: application/text
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_bvector.h libstdc++-v3/include/bits/stl_bvector.h
--- libstdc++-v3.so_7.clean/include/bits/stl_bvector.h 2005-07-05 08:46:01.000000000 +0100
+++ libstdc++-v3/include/bits/stl_bvector.h 2005-07-27 19:35:07.000000000 +0100
@@ -648,9 +648,15 @@
std::copy(__x.begin(), __x.end(), this->_M_impl._M_start);
}
- vector(__gnu_cxx::__rvalref<vector> __x)
- : _Bvector_base<_Alloc>(__x.get_allocator())
- { this->swap(__x.__ref); }
+ /**
+ * This constructor is templated to avoid it being used while deducing
+ * the things convertible to vector, and will only compile when the
+ * input vector has identical type.
+ */
+ template<typename _Vector>
+ vector(__gnu_cxx::__rvalref<_Vector> __x)
+ : _Bvector_base<_Alloc>(__x.__ref.get_allocator())
+ { this->swap(__x.__ref); }
// Check whether it's an integral type. If so, it's not an iterator.
template<class _Integer>
@@ -695,12 +701,18 @@
return *this;
}
- vector&
- operator=(__gnu_cxx::__rvalref<vector> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ /**
+ * This operator is templated to avoid it being used while deducing
+ * the things convertible to vector, and will only compile when the
+ * input vector has identical type.
+ */
+ template<typename _Vector>
+ vector&
+ operator=(__gnu_cxx::__rvalref<_Vector> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
// assign(), a generalized assignment member function. Two
// versions: one that takes a count, and one that takes a range.
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_deque.h libstdc++-v3/include/bits/stl_deque.h
--- libstdc++-v3.so_7.clean/include/bits/stl_deque.h 2005-07-27 20:04:20.000000000 +0100
+++ libstdc++-v3/include/bits/stl_deque.h 2005-07-27 18:48:46.000000000 +0100
@@ -690,15 +690,19 @@
_M_get_Tp_allocator()); }
/**
- * @brief %Deque move constructor
- * @param x A %deque of identical element and allocator types
+ * @brief %Deque move constructor
+ * @param x A %deque of identical element and allocator types
*
- * The newly-constructed %deque contains the exact contents of @a x.
- * The contents of x are a valid, but unspecified deque.
- */
- deque(__gnu_cxx::__rvalref<deque> __x)
- : _Base(__x.__ref.get_allocator(), 0)
- { this->swap(__x.__ref); }
+ * The newly-constructed %deque contains the exact contents of @a x.
+ * The contents of x are a valid, but unspecified deque.
+ * This constructor is templated to avoid it being used while deducing
+ * the things convertible to deque, and will only compile when the
+ * input deque has identical type.
+ */
+ template<typename _Deque>
+ deque(__gnu_cxx::__rvalref<_Deque> __x)
+ : _Base(__x.__ref.get_allocator(), 0)
+ { this->swap(__x.__ref); }
/**
@@ -749,14 +753,17 @@
* @param x A %deque of identical element and allocator types.
*
* The contents of @a x are moved into this deque (without copying).
- * @a x is a valid, but unspecified deque.
- */
- deque&
- operator=(__gnu_cxx::__rvalref<deque> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ * @a x is a valid, but unspecified deque. This operator is templated
+ * to avoid it being used while deducing the things convertible to
+ * deque, and will only compile when the input deque has identical type.
+ */
+ template<typename _Deque>
+ deque&
+ operator=(__gnu_cxx::__rvalref<_Deque> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
/**
* @brief Assigns a given value to a %deque.
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_list.h libstdc++-v3/include/bits/stl_list.h
--- libstdc++-v3.so_7.clean/include/bits/stl_list.h 2005-07-27 20:04:20.000000000 +0100
+++ libstdc++-v3/include/bits/stl_list.h 2005-07-27 18:40:11.000000000 +0100
@@ -491,15 +491,19 @@
{ this->insert(begin(), __x.begin(), __x.end()); }
/**
- * @brief %List move constructor
- * @param x A %list of identical element and allocator types
+ * @brief %List move constructor
+ * @param x A %list of identical element and allocator types
*
- * The newly-constructed %list contains the exact contents of @a x.
- * The contents of x are a valid, but unspecified list.
- */
- list(__gnu_cxx::__rvalref<list> __x)
- : _Base(__x.__ref.get_allocator())
- { this->swap(__x.__ref); }
+ * The newly-constructed %list contains the exact contents of @a x.
+ * The contents of x are a valid, but unspecified list. This
+ * constructor is templated to avoid it being used while deducing
+ * the things convertible to list, and will only compile when the
+ * input list has identical type.
+ */
+ template<typename _List>
+ list(__gnu_cxx::__rvalref<_List> __x)
+ : _Base(__x.__ref.get_allocator())
+ { this->swap(__x.__ref); }
/**
* @brief Builds a %list from a range.
@@ -544,14 +548,17 @@
* @param x A %list of identical element and allocator types.
*
* The contents of @a x are moved into this list (without copying).
- * @a x is a valid, but unspecified list.
- */
- list&
- operator=(__gnu_cxx::__rvalref<list> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ * @a x is a valid, but unspecified list. This operator is templated
+ * to avoid it being used while deducing the things convertible to
+ * list, and will only compile when the input list has identical type.
+ */
+ template<typename _List>
+ list&
+ operator=(__gnu_cxx::__rvalref<_List> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
/**
* @brief Assigns a given value to a %list.
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_map.h libstdc++-v3/include/bits/stl_map.h
--- libstdc++-v3.so_7.clean/include/bits/stl_map.h 2005-07-27 20:04:21.000000000 +0100
+++ libstdc++-v3/include/bits/stl_map.h 2005-07-27 19:20:48.000000000 +0100
@@ -169,15 +169,19 @@
: _M_t(__x._M_t) { }
/**
- * @brief %Map move constructor
- * @param x A %map of identical element and allocator types
+ * @brief %Map move constructor
+ * @param x A %map of identical element and allocator types
*
- * The newly-constructed %map contains the exact contents of @a x.
- * The contents of x are a valid, but unspecified map.
- */
- map(__gnu_cxx::__rvalref<map> __x)
- : _M_t(__x.__ref._M_t.key_comp() , __x.__ref.get_allocator())
- { this->swap(__x.__ref); }
+ * The newly-constructed %map contains the exact contents of @a x.
+ * The contents of x are a valid, but unspecified map. This
+ * constructor is templated to avoid it being used while deducing
+ * the things convertible to map, and will only compile when the
+ * input map has identical type.
+ */
+ template<typename _Map>
+ map(__gnu_cxx::__rvalref<_Map> __x)
+ : _M_t(__x.__ref._M_t.key_comp(), __x.__ref.get_allocator())
+ { this->swap(__x.__ref); }
/**
* @brief Builds a %map from a range.
@@ -225,14 +229,17 @@
* @param x A %map of identical element and allocator types.
*
* The contents of @a x are moved into this map (without copying).
- * @a x is a valid, but unspecified map.
- */
- map&
- operator=(__gnu_cxx::__rvalref<map> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ * @a x is a valid, but unspecified map. This operator is templated
+ * to avoid it being used while deducing the things convertible to
+ * map, and will only compile when the input map has identical type.
+ */
+ template<typename _Map>
+ map&
+ operator=(__gnu_cxx::__rvalref<_Map> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
/// Get a copy of the memory allocation object.
allocator_type
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_multimap.h libstdc++-v3/include/bits/stl_multimap.h
--- libstdc++-v3.so_7.clean/include/bits/stl_multimap.h 2005-07-27 20:04:21.000000000 +0100
+++ libstdc++-v3/include/bits/stl_multimap.h 2005-07-27 19:22:43.000000000 +0100
@@ -183,15 +183,19 @@
: _M_t(__x._M_t) { }
/**
- * @brief %Multimap move constructor
- * @param x A %Multimap of identical element and allocator types
+ * @brief %Multimap move constructor
+ * @param x A %Multimap of identical element and allocator types
*
- * The newly-constructed %multimap contains the exact contents of @a x.
- * The contents of x are a valid, but unspecified multimap.
- */
- multimap(__gnu_cxx::__rvalref<multimap> __x)
- : _M_t(__x.__ref._M_t.key_comp() , __x.__ref.get_allocator())
- { this->swap(__x.__ref); }
+ * The newly-constructed %multimap contains the exact contents of @a x.
+ * The contents of x are a valid, but unspecified multimap. This
+ * constructor is templated to avoid it being used while deducing
+ * the things convertible to multimap, and will only compile when the
+ * input multimap has identical type.
+ */
+ template<typename _Multimap>
+ multimap(__gnu_cxx::__rvalref<_Multimap> __x)
+ : _M_t(__x.__ref._M_t.key_comp(), __x.__ref.get_allocator())
+ { this->swap(__x.__ref); }
/**
* @brief Builds a %multimap from a range.
@@ -239,14 +243,18 @@
* @param x A %multimap of identical element and allocator types.
*
* The contents of @a x are moved into this multimap (without copying).
- * @a x is a valid, but unspecified multimap.
- */
- multimap&
- operator=(__gnu_cxx::__rvalref<multimap> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ * @a x is a valid, but unspecified multimap. This operator is
+ * templated to avoid it being used while deducing the things
+ * convertible to multimap, and will only compile when the
+ * input multimap has identical type.
+ */
+ template<typename _Multimap>
+ multimap&
+ operator=(__gnu_cxx::__rvalref<_Multimap> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
/// Get a copy of the memory allocation object.
allocator_type
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_multiset.h libstdc++-v3/include/bits/stl_multiset.h
--- libstdc++-v3.so_7.clean/include/bits/stl_multiset.h 2005-07-27 20:04:21.000000000 +0100
+++ libstdc++-v3/include/bits/stl_multiset.h 2005-07-27 19:23:02.000000000 +0100
@@ -183,15 +183,19 @@
: _M_t(__x._M_t) { }
/**
- * @brief %Multiset move constructor
- * @param x A %multiset of identical element and allocator types
+ * @brief %Multiset move constructor
+ * @param x A %multiset of identical element and allocator types
*
- * The newly-constructed %multiset contains the exact contents of @a x.
- * The contents of x are a valid, but unspecified multiset.
- */
- multiset(__gnu_cxx::__rvalref<multiset> __x)
- : _M_t(__x.__ref._M_t.key_comp() , __x.__ref.get_allocator())
- { this->swap(__x.__ref); }
+ * The newly-constructed %multiset contains the exact contents of @a x.
+ * The contents of x are a valid, but unspecified multiset. This
+ * constructor is templated to avoid it being used while deducing
+ * the things convertible to multiset, and will only compile when the
+ * input multiset has identical type.
+ */
+ template<typename _Multiset>
+ multiset(__gnu_cxx::__rvalref<_Multiset> __x)
+ : _M_t(__x.__ref._M_t.key_comp(), __x.__ref.get_allocator())
+ { this->swap(__x.__ref); }
/**
* @brief %Multiset assignment operator.
@@ -212,14 +216,18 @@
* @param x A %multiset of identical element and allocator types.
*
* The contents of @a x are moved into this multiset (without copying).
- * @a x is a valid, but unspecified multiset.
- */
- multiset&
- operator=(__gnu_cxx::__rvalref<multiset> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ * @a x is a valid, but unspecified multiset. This constructor is
+ * templated to avoid it being used while deducing the things
+ * convertible to multiset, and will only compile when the
+ * input multiset has identical type.
+ */
+ template<typename _Multiset>
+ multiset&
+ operator=(__gnu_cxx::__rvalref<_Multiset> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
// accessors:
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_set.h libstdc++-v3/include/bits/stl_set.h
--- libstdc++-v3.so_7.clean/include/bits/stl_set.h 2005-07-27 20:04:21.000000000 +0100
+++ libstdc++-v3/include/bits/stl_set.h 2005-07-27 19:17:23.000000000 +0100
@@ -191,15 +191,19 @@
: _M_t(__x._M_t) { }
/**
- * @brief %Set move constructor
- * @param x A %set of identical element and allocator types
+ * @brief %Set move constructor
+ * @param x A %set of identical element and allocator types
*
- * The newly-constructed %set contains the exact contents of @a x.
- * The contents of x are a valid, but unspecified set.
- */
- set(__gnu_cxx::__rvalref<set> __x)
- : _M_t(__x.__ref._M_t.key_comp() , __x.__ref.get_allocator())
- { this->swap(__x.__ref); }
+ * The newly-constructed %set contains the exact contents of @a x.
+ * The contents of x are a valid, but unspecified set. This
+ * constructor is templated to avoid it being used while deducing
+ * the things convertible to set, and will only compile when the
+ * input set has identical type.
+ */
+ template<typename _Set>
+ set(__gnu_cxx::__rvalref<_Set> __x)
+ : _M_t(__x.__ref._M_t.key_comp() , __x.__ref.get_allocator())
+ { this->swap(__x.__ref); }
/**
* @brief Set assignment operator.
@@ -220,14 +224,17 @@
* @param x A %set of identical element and allocator types.
*
* The contents of @a x are moved into this set (without copying).
- * @a x is a valid, but unspecified set.
- */
- set&
- operator=(__gnu_cxx::__rvalref<set> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ * @a x is a valid, but unspecified set. This operator is templated
+ * to avoid it being used while deducing the things convertible to
+ * set, and will only compile when the input set has identical type.
+ */
+ template<typename _Set>
+ set&
+ operator=(__gnu_cxx::__rvalref<_Set> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
// accessors:
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_vector.h libstdc++-v3/include/bits/stl_vector.h
--- libstdc++-v3.so_7.clean/include/bits/stl_vector.h 2005-07-27 20:04:22.000000000 +0100
+++ libstdc++-v3/include/bits/stl_vector.h 2005-07-27 19:30:20.000000000 +0100
@@ -235,15 +235,19 @@
}
/**
- * @brief %Vector move constructor
- * @param x A %vector of identical element and allocator types
+ * @brief %Vector move constructor
+ * @param x A %vector of identical element and allocator types
*
- * The newly-constructed %vector contains the exact contents of @a x.
- * The contents of x are a valid, but unspecified vector.
- */
- vector(__gnu_cxx::__rvalref<vector> __x)
- : _Base(__x.__ref.get_allocator())
- { this->swap(__x.__ref); }
+ * The newly-constructed %vector contains the exact contents of @a x.
+ * The contents of x are a valid, but unspecified vector. This
+ * constructor is templated to avoid it being used while deducing
+ * the things convertible to vector, and will only compile
+ * when the input vector has identical type.
+ */
+ template<typename _Vector>
+ vector(__gnu_cxx::__rvalref<_Vector> __x)
+ : _Base(__x.__ref.get_allocator())
+ { this->swap(__x.__ref); }
/**
* @brief Builds a %vector from a range.
@@ -297,14 +301,18 @@
* @param x A %vector of identical element and allocator types.
*
* The contents of @a x are moved into this vector (without copying).
- * @a x is a valid, but unspecified vector.
- */
- vector&
- operator=(__gnu_cxx::__rvalref<vector> __x)
- {
- this->swap(__x.__ref);
- return *this;
- }
+ * @a x is a valid, but unspecified vector. This operator is templated
+ * to avoid it being used while deducing the things convertible
+ * to vector, and will only compile when the input vector has
+ * identical type.
+ */
+ template<typename _Vector>
+ vector&
+ operator=(__gnu_cxx::__rvalref<_Vector> __x)
+ {
+ this->swap(__x.__ref);
+ return *this;
+ }
/**
* @brief Assigns a given value to a %vector.
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/deque/moveable2.cc libstdc++-v3/testsuite/23_containers/deque/moveable2.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/deque/moveable2.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/deque/moveable2.cc 2005-07-27 20:33:24.000000000 +0100
@@ -0,0 +1,45 @@
+// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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 }
+
+#include <deque>
+
+struct A
+{
+ template <typename B> operator B() const
+ {
+ return B();
+ }
+};
+
+void function(void)
+{
+ A a;
+ std::deque<int> v;
+ v = a;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/list/moveable2.cc libstdc++-v3/testsuite/23_containers/list/moveable2.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/list/moveable2.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/list/moveable2.cc 2005-07-27 20:33:24.000000000 +0100
@@ -0,0 +1,45 @@
+// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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 }
+
+#include <list>
+
+struct A
+{
+ template <typename B> operator B() const
+ {
+ return B();
+ }
+};
+
+void function(void)
+{
+ A a;
+ std::list<int> v;
+ v = a;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/map/moveable2.cc libstdc++-v3/testsuite/23_containers/map/moveable2.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/map/moveable2.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/map/moveable2.cc 2005-07-27 20:33:24.000000000 +0100
@@ -0,0 +1,45 @@
+// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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 }
+
+#include <map>
+
+struct A
+{
+ template <typename B> operator B() const
+ {
+ return B();
+ }
+};
+
+void function(void)
+{
+ A a;
+ std::map<int,int> v;
+ v = a;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/multimap/moveable2.cc libstdc++-v3/testsuite/23_containers/multimap/moveable2.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/multimap/moveable2.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/multimap/moveable2.cc 2005-07-27 20:47:25.000000000 +0100
@@ -0,0 +1,45 @@
+// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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 }
+
+#include <map>
+
+struct A
+{
+ template <typename B> operator B() const
+ {
+ return B();
+ }
+};
+
+void function(void)
+{
+ A a;
+ std::multimap<int,int> v;
+ v = a;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/multiset/moveable2.cc libstdc++-v3/testsuite/23_containers/multiset/moveable2.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/multiset/moveable2.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/multiset/moveable2.cc 2005-07-27 20:47:29.000000000 +0100
@@ -0,0 +1,45 @@
+// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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 }
+
+#include <set>
+
+struct A
+{
+ template <typename B> operator B() const
+ {
+ return B();
+ }
+};
+
+void function(void)
+{
+ A a;
+ std::multiset<int> v;
+ v = a;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/set/moveable2.cc libstdc++-v3/testsuite/23_containers/set/moveable2.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/set/moveable2.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/set/moveable2.cc 2005-07-27 20:33:24.000000000 +0100
@@ -0,0 +1,45 @@
+// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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 }
+
+#include <set>
+
+struct A
+{
+ template <typename B> operator B() const
+ {
+ return B();
+ }
+};
+
+void function(void)
+{
+ A a;
+ std::set<int> v;
+ v = a;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/vector/moveable.cc libstdc++-v3/testsuite/23_containers/vector/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/vector/moveable.cc 2005-07-05 08:46:25.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/vector/moveable.cc 2005-07-27 19:39:41.000000000 +0100
@@ -33,7 +33,8 @@
#include <vector>
#include <testsuite_hooks.h>
-int main()
+
+void test01()
{
bool test __attribute__((unused)) = true;
@@ -45,5 +46,25 @@
std::vector<int> c(__gnu_cxx::__move(b));
VERIFY( c.size() == 1 && c[0] == 1 );
VERIFY( b.size() == 0 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<bool> a,b;
+ a.push_back(1);
+ b = __gnu_cxx::__move(a);
+ VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 );
+
+ std::vector<bool> c(__gnu_cxx::__move(b));
+ VERIFY( c.size() == 1 && c[0] == 1 );
+ VERIFY( b.size() == 0 );
+}
+
+int main(void)
+{
+ test01();
+ test02();
return 0;
}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/23_containers/vector/moveable2.cc libstdc++-v3/testsuite/23_containers/vector/moveable2.cc
--- libstdc++-v3.so_7.clean/testsuite/23_containers/vector/moveable2.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/vector/moveable2.cc 2005-07-27 20:33:24.000000000 +0100
@@ -0,0 +1,48 @@
+// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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 }
+
+#include <vector>
+
+struct A
+{
+ template <typename B> operator B() const
+ {
+ return B();
+ }
+};
+
+void function(void)
+{
+ A a;
+ std::vector<int> v;
+ v = a;
+
+ std::vector<bool> w;
+ w = a;
+}
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |