aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-10-27 00:41:21 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-10-27 00:41:21 +0000
commit61fcb9fb0c6d18cb89d163b2228124af7173d54f (patch)
tree90a7feb935d3646f760bb5642127bacfc9aab08c
parent00e65cfa892d1a2ed1e3f499df47acf7b797251b (diff)
downloadgcc-61fcb9fb0c6d18cb89d163b2228124af7173d54f.zip
gcc-61fcb9fb0c6d18cb89d163b2228124af7173d54f.tar.gz
gcc-61fcb9fb0c6d18cb89d163b2228124af7173d54f.tar.bz2
throw_allocator.h (throw_allocator<>:: construct<>(pointer, _Args&&...)): Add.
2007-10-26 Paolo Carlini <pcarlini@suse.de> * include/ext/throw_allocator.h (throw_allocator<>:: construct<>(pointer, _Args&&...)): Add. * include/ext/pool_allocator.h (__pool_alloc<>:: construct<>(pointer, _Args&&...)): Likewise. (construct(pointer, const _Tp&)): Cast pointer to void*. * include/ext/bitmap_allocator.h (bitmap_allocator<>:: construct<>(pointer, _Args&&...)): Add. (construct(pointer, const _Tp&)): Cast pointer to void*. * include/ext/new_allocator.h (new_allocator<>:: construct<>(pointer, _Args&&...)): Add. (construct(pointer, const _Tp&)): Cast pointer to void*. * include/ext/malloc_allocator.h (malloc_allocator<>:: construct<>(pointer, _Args&&...)): Add. (construct(pointer, const _Tp&)): Cast pointer to void*. * include/ext/array_allocator.h (array_allocator<>:: construct<>(pointer, _Args&&...)): Add. (construct(pointer, const _Tp&)): Cast pointer to void*. * include/ext/mt_allocator.h (__mt_alloc<>:: construct<>(pointer, _Args&&...)): Add. (construct(pointer, const _Tp&)): Cast pointer to void*. * testsuite/util/testsuite_allocator.h (tracker_allocator<>:: construct<>(pointer, _Args&&...)): Add. (construct(pointer, const _Tp&)): Cast pointer to void*. (uneq_allocator<>::construct<>(pointer, _Args&&...)): Add. (construct(pointer, const _Tp&)): Cast pointer to void*. * testsuite/ext/mt_allocator/variadic_construct.cc: New. * testsuite/ext/new_allocator/variadic_construct.cc: Likewise. * testsuite/ext/throw_allocator/variadic_construct.cc: Likewise. * testsuite/ext/malloc_allocator/variadic_construct.cc: Likewise. * testsuite/ext/pool_allocator/variadic_construct.cc: Likewise. * testsuite/ext/bitmap_allocator/variadic_construct.cc: Likewise. * testsuite/ext/array_allocator/variadic_construct.cc: Likewise. From-SVN: r129672
-rw-r--r--libstdc++-v3/ChangeLog35
-rw-r--r--libstdc++-v3/include/ext/array_allocator.h12
-rw-r--r--libstdc++-v3/include/ext/bitmap_allocator.h13
-rw-r--r--libstdc++-v3/include/ext/malloc_allocator.h12
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h12
-rw-r--r--libstdc++-v3/include/ext/new_allocator.h10
-rw-r--r--libstdc++-v3/include/ext/pool_allocator.h10
-rw-r--r--libstdc++-v3/include/ext/throw_allocator.h11
-rw-r--r--libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc50
-rw-r--r--libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc46
-rw-r--r--libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc46
-rw-r--r--libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc46
-rw-r--r--libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc46
-rw-r--r--libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc46
-rw-r--r--libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc46
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_allocator.h24
16 files changed, 451 insertions, 14 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 5ff4804..820e03b 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,38 @@
+2007-10-26 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/throw_allocator.h (throw_allocator<>::
+ construct<>(pointer, _Args&&...)): Add.
+ * include/ext/pool_allocator.h (__pool_alloc<>::
+ construct<>(pointer, _Args&&...)): Likewise.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ * include/ext/bitmap_allocator.h (bitmap_allocator<>::
+ construct<>(pointer, _Args&&...)): Add.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ * include/ext/new_allocator.h (new_allocator<>::
+ construct<>(pointer, _Args&&...)): Add.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ * include/ext/malloc_allocator.h (malloc_allocator<>::
+ construct<>(pointer, _Args&&...)): Add.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ * include/ext/array_allocator.h (array_allocator<>::
+ construct<>(pointer, _Args&&...)): Add.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ * include/ext/mt_allocator.h (__mt_alloc<>::
+ construct<>(pointer, _Args&&...)): Add.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ * testsuite/util/testsuite_allocator.h (tracker_allocator<>::
+ construct<>(pointer, _Args&&...)): Add.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ (uneq_allocator<>::construct<>(pointer, _Args&&...)): Add.
+ (construct(pointer, const _Tp&)): Cast pointer to void*.
+ * testsuite/ext/mt_allocator/variadic_construct.cc: New.
+ * testsuite/ext/new_allocator/variadic_construct.cc: Likewise.
+ * testsuite/ext/throw_allocator/variadic_construct.cc: Likewise.
+ * testsuite/ext/malloc_allocator/variadic_construct.cc: Likewise.
+ * testsuite/ext/pool_allocator/variadic_construct.cc: Likewise.
+ * testsuite/ext/bitmap_allocator/variadic_construct.cc: Likewise.
+ * testsuite/ext/array_allocator/variadic_construct.cc: Likewise.
+
2007-10-26 Benjamin Kosnik <bkoz@redhat.com>
* include/std/unordered_map: Fix for parallel mode.
diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h
index 0bbd97a..d5f7092 100644
--- a/libstdc++-v3/include/ext/array_allocator.h
+++ b/libstdc++-v3/include/ext/array_allocator.h
@@ -1,6 +1,6 @@
// array allocator -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007 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
@@ -38,6 +38,7 @@
#include <new>
#include <bits/functexcept.h>
#include <tr1/array>
+#include <bits/stl_move.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -77,7 +78,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
- { ::new(__p) value_type(__val); }
+ { ::new((void *)__p) value_type(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
void
destroy(pointer __p) { __p->~_Tp(); }
diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h
index 93fa8e6..91f5b14 100644
--- a/libstdc++-v3/include/ext/bitmap_allocator.h
+++ b/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -1,6 +1,6 @@
// Bitmap Allocator. -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007 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,7 +41,7 @@
#include <new> // For operator new.
#include <debug/debug.h> // _GLIBCXX_DEBUG_ASSERT
#include <ext/concurrence.h>
-
+#include <bits/stl_move.h>
/** @brief The constant in the expression below is the alignment
* required in bytes.
@@ -1089,7 +1089,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
void
construct(pointer __p, const_reference __data)
- { ::new(__p) value_type(__data); }
+ { ::new((void *)__p) value_type(__data); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
void
destroy(pointer __p)
diff --git a/libstdc++-v3/include/ext/malloc_allocator.h b/libstdc++-v3/include/ext/malloc_allocator.h
index 531045b..a5d31684 100644
--- a/libstdc++-v3/include/ext/malloc_allocator.h
+++ b/libstdc++-v3/include/ext/malloc_allocator.h
@@ -1,6 +1,6 @@
// Allocator that wraps "C" malloc -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -38,6 +38,7 @@
#include <cstdlib>
#include <new>
#include <bits/functexcept.h>
+#include <bits/stl_move.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -109,7 +110,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
- { ::new(__p) value_type(__val); }
+ { ::new((void *)__p) value_type(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
void
destroy(pointer __p) { __p->~_Tp(); }
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 6083cdb..425a485 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -1,6 +1,6 @@
// MT-optimized allocator -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005, 2006, 2007 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
@@ -38,6 +38,7 @@
#include <cstdlib>
#include <bits/functexcept.h>
#include <ext/atomicity.h>
+#include <bits/stl_move.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -593,7 +594,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
- { ::new(__p) _Tp(__val); }
+ { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
void
destroy(pointer __p) { __p->~_Tp(); }
diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h
index 938783c..14f1de9 100644
--- a/libstdc++-v3/include/ext/new_allocator.h
+++ b/libstdc++-v3/include/ext/new_allocator.h
@@ -36,6 +36,7 @@
#include <new>
#include <bits/functexcept.h>
+#include <bits/stl_move.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -104,7 +105,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
- { ::new(__p) _Tp(__val); }
+ { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
void
destroy(pointer __p) { __p->~_Tp(); }
diff --git a/libstdc++-v3/include/ext/pool_allocator.h b/libstdc++-v3/include/ext/pool_allocator.h
index f9dcc7f..3259d98 100644
--- a/libstdc++-v3/include/ext/pool_allocator.h
+++ b/libstdc++-v3/include/ext/pool_allocator.h
@@ -54,6 +54,7 @@
#include <bits/functexcept.h>
#include <ext/atomicity.h>
#include <ext/concurrence.h>
+#include <bits/stl_move.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -164,7 +165,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
- { ::new(__p) _Tp(__val); }
+ { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
void
destroy(pointer __p) { __p->~_Tp(); }
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index 78b78f1..f6d0b29 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -60,6 +60,7 @@
#include <utility>
#include <tr1/random>
#include <bits/functexcept.h>
+#include <bits/stl_move.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -232,6 +233,16 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
construct(pointer __p, const T& val)
{ return std::allocator<value_type>().construct(__p, val); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ {
+ return std::allocator<value_type>().
+ construct(__p, std::forward<_Args>(__args)...);
+ }
+#endif
+
void
destroy(pointer __p)
{ std::allocator<value_type>().destroy(__p); }
diff --git a/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc
new file mode 100644
index 0000000..5c3f9a5
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-27 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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.
+
+// 20.4.1.1 allocator members
+
+#include <ext/array_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::pair<int, char> pair_type;
+ typedef std::tr1::array<pair_type, 3> array_type;
+ array_type store;
+
+ __gnu_cxx::array_allocator<pair_type, array_type> alloc1(&store);
+ pair_type* ptp1 = alloc1.allocate(1);
+ alloc1.construct(ptp1, 3, 'a');
+
+ VERIFY( ptp1->first == 3 );
+ VERIFY( ptp1->second == 'a' );
+
+ alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc
new file mode 100644
index 0000000..4e911e1
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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.
+
+#include <ext/bitmap_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::pair<int, char> pair_type;
+ __gnu_cxx::bitmap_allocator<pair_type> alloc1;
+
+ pair_type* ptp1 = alloc1.allocate(1);
+ alloc1.construct(ptp1, 3, 'a');
+
+ VERIFY( ptp1->first == 3 );
+ VERIFY( ptp1->second == 'a' );
+
+ alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc
new file mode 100644
index 0000000..39163c8
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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.
+
+#include <ext/malloc_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::pair<int, char> pair_type;
+ __gnu_cxx::malloc_allocator<pair_type> alloc1;
+
+ pair_type* ptp1 = alloc1.allocate(1);
+ alloc1.construct(ptp1, 3, 'a');
+
+ VERIFY( ptp1->first == 3 );
+ VERIFY( ptp1->second == 'a' );
+
+ alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc
new file mode 100644
index 0000000..8416c68
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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.
+
+#include <ext/mt_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::pair<int, char> pair_type;
+ __gnu_cxx::__mt_alloc<pair_type> alloc1;
+
+ pair_type* ptp1 = alloc1.allocate(1);
+ alloc1.construct(ptp1, 3, 'a');
+
+ VERIFY( ptp1->first == 3 );
+ VERIFY( ptp1->second == 'a' );
+
+ alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc
new file mode 100644
index 0000000..575e237
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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.
+
+#include <ext/new_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::pair<int, char> pair_type;
+ __gnu_cxx::new_allocator<pair_type> alloc1;
+
+ pair_type* ptp1 = alloc1.allocate(1);
+ alloc1.construct(ptp1, 3, 'a');
+
+ VERIFY( ptp1->first == 3 );
+ VERIFY( ptp1->second == 'a' );
+
+ alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc
new file mode 100644
index 0000000..7d453b6
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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.
+
+#include <ext/pool_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::pair<int, char> pair_type;
+ __gnu_cxx::__pool_alloc<pair_type> alloc1;
+
+ pair_type* ptp1 = alloc1.allocate(1);
+ alloc1.construct(ptp1, 3, 'a');
+
+ VERIFY( ptp1->first == 3 );
+ VERIFY( ptp1->second == 'a' );
+
+ alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc
new file mode 100644
index 0000000..66766d0
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-26 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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.
+
+#include <ext/throw_allocator.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::pair<int, char> pair_type;
+ __gnu_cxx::throw_allocator<pair_type> alloc1;
+
+ pair_type* ptp1 = alloc1.allocate(1);
+ alloc1.construct(ptp1, 3, 'a');
+
+ VERIFY( ptp1->first == 3 );
+ VERIFY( ptp1->second == 'a' );
+
+ alloc1.deallocate(ptp1, 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index d6108cc..d162e21 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -39,6 +39,7 @@
#include <cstddef>
#include <tr1/unordered_map>
#include <cassert>
+#include <bits/stl_move.h>
namespace
{
@@ -153,10 +154,20 @@ namespace __gnu_test
void
construct(pointer p, const T& value)
{
- new (p) T(value);
+ ::new ((void *)p) T(value);
counter_type::construct();
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... Args>
+ void
+ construct(pointer p, Args&&... args)
+ {
+ ::new((void *)p) T(std::forward<Args>(args)...);
+ counter_type::construct();
+ }
+#endif
+
void
destroy(pointer p)
{
@@ -338,8 +349,15 @@ namespace __gnu_test
void
construct(pointer p, const Tp& val)
- { ::new(p) Tp(val); }
-
+ { ::new((void *)p) Tp(val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... Args>
+ void
+ construct(pointer p, Args&&... args)
+ { ::new((void *)p) Tp(std::forward<Args>(args)...); }
+#endif
+
void
destroy(pointer p) { p->~Tp(); }