aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2005-06-06 16:59:55 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2005-06-06 16:59:55 +0000
commit2fecaef4af7206fbae14906000e8c81007514706 (patch)
tree135c01c04b56fa8a36110efaa5e5b5d8c1be6e9d
parent1651a990f79d932c591ae20035536d7b4449f6f4 (diff)
downloadgcc-2fecaef4af7206fbae14906000e8c81007514706.zip
gcc-2fecaef4af7206fbae14906000e8c81007514706.tar.gz
gcc-2fecaef4af7206fbae14906000e8c81007514706.tar.bz2
[multiple changes]
2005-06-06 Paolo Carlini <pcarlini@suse.de> Port from libstdcxx_so_7-branch: 2004-09-24 Paolo Carlini <pcarlini@suse.de> Jonathan Wakely <redi@gcc.gnu.org> * include/bits/stl_list.h (list::list(size_type, value_type, const allocator_type&): Implement according to the letter of the standard, i.e., don't use two overloads, not equivalent in case of non default constructible T. (list::resize(size_type, const value_type&)): Fix the signature: according to the standard the second argument is by value; also, don't use two overloads. * include/bits/list.tcc (list::resize(size_type, const value_type&)): Adjust consistently the signature. * include/bits/stl_deque.h (deque::deque(size_type, value_type, const allocator_type&)): Likewise. (deque::resize(size_type, const value_type&)): Likewise. * include/bits/stl_vector.h (vector::vector(size_type, value_type, const allocator_type&)): Likewise. (vector::resize(size_type, const value_type&)): Likewise. * testsuite/testsuite_hooks.h: Add NonDefaultConstructible test type. * testsuite/23_containers/deque/explicit_instantiation/2.cc: New. * testsuite/23_containers/list/explicit_instantiation/2.cc: New. * testsuite/23_containers/map/explicit_instantiation/2.cc: New. * testsuite/23_containers/multimap/explicit_instantiation/2.cc: New. * testsuite/23_containers/multiset/explicit_instantiation/2.cc: New. * testsuite/23_containers/set/explicit_instantiation/2.cc: New. * testsuite/23_containers/vector/explicit_instantiation/2.cc: New. * include/bits/deque.tcc: Minor formatting fix. From-SVN: r100668
-rw-r--r--libstdc++-v3/ChangeLog32
-rw-r--r--libstdc++-v3/include/bits/deque.tcc6
-rw-r--r--libstdc++-v3/include/bits/list.tcc4
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h30
-rw-r--r--libstdc++-v3/include/bits/stl_list.h30
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h35
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation/2.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/explicit_instantiation/2.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/explicit_instantiation/2.cc37
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation/2.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation/2.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/explicit_instantiation/2.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation/2.cc35
-rw-r--r--libstdc++-v3/testsuite/testsuite_hooks.h18
14 files changed, 312 insertions, 91 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 442fb3f..3a91b00 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,35 @@
+2005-06-06 Paolo Carlini <pcarlini@suse.de>
+
+ Port from libstdcxx_so_7-branch:
+ 2004-09-24 Paolo Carlini <pcarlini@suse.de>
+ Jonathan Wakely <redi@gcc.gnu.org>
+
+ * include/bits/stl_list.h (list::list(size_type, value_type,
+ const allocator_type&): Implement according to the letter of the
+ standard, i.e., don't use two overloads, not equivalent in case
+ of non default constructible T.
+ (list::resize(size_type, const value_type&)): Fix the signature:
+ according to the standard the second argument is by value; also,
+ don't use two overloads.
+ * include/bits/list.tcc (list::resize(size_type, const value_type&)):
+ Adjust consistently the signature.
+ * include/bits/stl_deque.h (deque::deque(size_type, value_type,
+ const allocator_type&)): Likewise.
+ (deque::resize(size_type, const value_type&)): Likewise.
+ * include/bits/stl_vector.h (vector::vector(size_type, value_type,
+ const allocator_type&)): Likewise.
+ (vector::resize(size_type, const value_type&)): Likewise.
+ * testsuite/testsuite_hooks.h: Add NonDefaultConstructible test type.
+ * testsuite/23_containers/deque/explicit_instantiation/2.cc: New.
+ * testsuite/23_containers/list/explicit_instantiation/2.cc: New.
+ * testsuite/23_containers/map/explicit_instantiation/2.cc: New.
+ * testsuite/23_containers/multimap/explicit_instantiation/2.cc: New.
+ * testsuite/23_containers/multiset/explicit_instantiation/2.cc: New.
+ * testsuite/23_containers/set/explicit_instantiation/2.cc: New.
+ * testsuite/23_containers/vector/explicit_instantiation/2.cc: New.
+
+ * include/bits/deque.tcc: Minor formatting fix.
+
2005-06-06 Peter Doerfler <doerfler@techinfo.rwth-aachen.de>
* include/bits/stl_function.h: ... and another one.
diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc
index 35ceb69..e69c79a 100644
--- a/libstdc++-v3/include/bits/deque.tcc
+++ b/libstdc++-v3/include/bits/deque.tcc
@@ -201,9 +201,9 @@ namespace _GLIBCXX_STD
template <typename _Tp, class _Alloc>
template <typename _InputIterator>
void
- deque<_Tp, _Alloc>
- ::_M_assign_aux(_InputIterator __first, _InputIterator __last,
- std::input_iterator_tag)
+ deque<_Tp, _Alloc>::
+ _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag)
{
iterator __cur = begin();
for (; __first != __last && __cur != end(); ++__cur, ++__first)
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index 14ea0f0..d65f73c 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -1,6 +1,6 @@
// List implementation (out of line) -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 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
@@ -102,7 +102,7 @@ namespace _GLIBCXX_STD
template<typename _Tp, typename _Alloc>
void
list<_Tp, _Alloc>::
- resize(size_type __new_size, const value_type& __x)
+ resize(size_type __new_size, value_type __x)
{
iterator __i = begin();
size_type __len = 0;
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index 249c4f2..5a20b65 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -669,24 +669,13 @@ namespace _GLIBCXX_STD
*
* This constructor fills the %deque with @a n copies of @a value.
*/
- deque(size_type __n, const value_type& __value,
+ explicit
+ deque(size_type __n, const value_type& __value = value_type(),
const allocator_type& __a = allocator_type())
: _Base(__a, __n)
{ _M_fill_initialize(__value); }
/**
- * @brief Create a %deque with default elements.
- * @param n The number of elements to initially create.
- *
- * This constructor fills the %deque with @a n copies of a
- * default-constructed element.
- */
- explicit
- deque(size_type __n)
- : _Base(allocator_type(), __n)
- { _M_fill_initialize(value_type()); }
-
- /**
* @brief %Deque copy constructor.
* @param x A %deque of identical element and allocator types.
*
@@ -874,7 +863,7 @@ namespace _GLIBCXX_STD
* data.
*/
void
- resize(size_type __new_size, const value_type& __x)
+ resize(size_type __new_size, value_type __x = value_type())
{
const size_type __len = size();
if (__new_size < __len)
@@ -884,19 +873,6 @@ namespace _GLIBCXX_STD
}
/**
- * @brief Resizes the %deque to the specified number of elements.
- * @param new_size Number of elements the %deque should contain.
- *
- * This function will resize the %deque to the specified number
- * of elements. If the number is smaller than the %deque's
- * current size the %deque is truncated, otherwise the %deque
- * is extended and new elements are default-constructed.
- */
- void
- resize(size_type new_size)
- { resize(new_size, value_type()); }
-
- /**
* Returns true if the %deque is empty. (Thus begin() would
* equal end().)
*/
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index 8790480..e17ec2b 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -472,24 +472,13 @@ namespace _GLIBCXX_STD
*
* This constructor fills the %list with @a n copies of @a value.
*/
- list(size_type __n, const value_type& __value,
+ explicit
+ list(size_type __n, const value_type& __value = value_type(),
const allocator_type& __a = allocator_type())
: _Base(__a)
{ this->insert(begin(), __n, __value); }
/**
- * @brief Create a %list with default elements.
- * @param n The number of elements to initially create.
- *
- * This constructor fills the %list with @a n copies of a
- * default-constructed element.
- */
- explicit
- list(size_type __n)
- : _Base(allocator_type())
- { this->insert(begin(), __n, value_type()); }
-
- /**
* @brief %List copy constructor.
* @param x A %list of identical element and allocator types.
*
@@ -679,20 +668,7 @@ namespace _GLIBCXX_STD
* extended and new elements are populated with given data.
*/
void
- resize(size_type __new_size, const value_type& __x);
-
- /**
- * @brief Resizes the %list to the specified number of elements.
- * @param new_size Number of elements the %list should contain.
- *
- * This function will resize the %list to the specified number of
- * elements. If the number is smaller than the %list's current
- * size the %list is truncated, otherwise the %list is extended
- * and new elements are default-constructed.
- */
- void
- resize(size_type __new_size)
- { this->resize(__new_size, value_type()); }
+ resize(size_type __new_size, value_type __x = value_type());
// element access
/**
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index dccc9dd..06b9401 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -206,7 +206,8 @@ namespace _GLIBCXX_STD
*
* This constructor fills the %vector with @a n copies of @a value.
*/
- vector(size_type __n, const value_type& __value,
+ explicit
+ vector(size_type __n, const value_type& __value = value_type(),
const allocator_type& __a = allocator_type())
: _Base(__n, __a)
{
@@ -216,22 +217,6 @@ namespace _GLIBCXX_STD
}
/**
- * @brief Create a %vector with default elements.
- * @param n The number of elements to initially create.
- *
- * This constructor fills the %vector with @a n copies of a
- * default-constructed element.
- */
- explicit
- vector(size_type __n)
- : _Base(__n, allocator_type())
- {
- std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, value_type(),
- _M_get_Tp_allocator());
- this->_M_impl._M_finish = this->_M_impl._M_start + __n;
- }
-
- /**
* @brief %Vector copy constructor.
* @param x A %vector of identical element and allocator types.
*
@@ -429,7 +414,7 @@ namespace _GLIBCXX_STD
* given data.
*/
void
- resize(size_type __new_size, const value_type& __x)
+ resize(size_type __new_size, value_type __x = value_type())
{
if (__new_size < size())
erase(begin() + __new_size, end());
@@ -438,20 +423,6 @@ namespace _GLIBCXX_STD
}
/**
- * @brief Resizes the %vector to the specified number of elements.
- * @param new_size Number of elements the %vector should contain.
- *
- * This function will resize the %vector to the specified
- * number of elements. If the number is smaller than the
- * %vector's current size the %vector is truncated, otherwise
- * the %vector is extended and new elements are
- * default-constructed.
- */
- void
- resize(size_type __new_size)
- { resize(__new_size, value_type()); }
-
- /**
* Returns the total number of elements that the %vector can
* hold before needing to allocate more memory.
*/
diff --git a/libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation/2.cc
new file mode 100644
index 0000000..7084ff7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation/2.cc
@@ -0,0 +1,35 @@
+// 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.
+
+// 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.
+
+// This file tests explicit instantiation of library containers
+
+#include <deque>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+template class std::deque<__gnu_test::NonDefaultConstructible>;
diff --git a/libstdc++-v3/testsuite/23_containers/list/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/list/explicit_instantiation/2.cc
new file mode 100644
index 0000000..66d3934
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/explicit_instantiation/2.cc
@@ -0,0 +1,35 @@
+// 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.
+
+// 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.
+
+// This file tests explicit instantiation of library containers
+
+#include <list>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+template class std::list<__gnu_test::NonDefaultConstructible>;
diff --git a/libstdc++-v3/testsuite/23_containers/map/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/map/explicit_instantiation/2.cc
new file mode 100644
index 0000000..8c3c744
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/explicit_instantiation/2.cc
@@ -0,0 +1,37 @@
+// 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.
+
+// 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.
+
+// This file tests explicit instantiation of library containers
+
+#include <map>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+// N.B. We cannot instantiate with T == NonDefaultConstructible
+// because of 23.3.1.2.
+template class std::map<__gnu_test::NonDefaultConstructible, double>;
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation/2.cc
new file mode 100644
index 0000000..46181ef3
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation/2.cc
@@ -0,0 +1,36 @@
+// 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.
+
+// 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.
+
+// This file tests explicit instantiation of library containers
+
+#include <map>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+template class std::multimap<__gnu_test::NonDefaultConstructible,
+ __gnu_test::NonDefaultConstructible>;
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation/2.cc
new file mode 100644
index 0000000..0f5f308
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation/2.cc
@@ -0,0 +1,35 @@
+// 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.
+
+// 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.
+
+// This file tests explicit instantiation of library containers
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+template class std::multiset<__gnu_test::NonDefaultConstructible>;
diff --git a/libstdc++-v3/testsuite/23_containers/set/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/set/explicit_instantiation/2.cc
new file mode 100644
index 0000000..418c80e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/explicit_instantiation/2.cc
@@ -0,0 +1,35 @@
+// 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.
+
+// 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.
+
+// This file tests explicit instantiation of library containers
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+template class std::set<__gnu_test::NonDefaultConstructible>;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation/2.cc
new file mode 100644
index 0000000..7020d42
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation/2.cc
@@ -0,0 +1,35 @@
+// 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.
+
+// 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.
+
+// This file tests explicit instantiation of library containers
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+template class std::vector<__gnu_test::NonDefaultConstructible>;
diff --git a/libstdc++-v3/testsuite/testsuite_hooks.h b/libstdc++-v3/testsuite/testsuite_hooks.h
index 90104d3..fc05186 100644
--- a/libstdc++-v3/testsuite/testsuite_hooks.h
+++ b/libstdc++-v3/testsuite/testsuite_hooks.h
@@ -160,6 +160,24 @@ namespace __gnu_test
void
run_tests_wrapped_env(const char*, const char*, const func_callback&);
+
+ // For containers (23.1/3).
+ struct NonDefaultConstructible
+ {
+ NonDefaultConstructible(int) { }
+ };
+
+ inline bool
+ operator==(const NonDefaultConstructible& lhs,
+ const NonDefaultConstructible& rhs)
+ { return false; }
+
+ inline bool
+ operator<(const NonDefaultConstructible& lhs,
+ const NonDefaultConstructible& rhs)
+ { return false; }
+
+
// Counting.
struct counter
{