]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
throw_allocator.h (throw_allocator<>:: construct<>(pointer, _Args&&...)): Add.
authorPaolo Carlini <pcarlini@suse.de>
Sat, 27 Oct 2007 00:41:21 +0000 (00:41 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 27 Oct 2007 00:41:21 +0000 (00:41 +0000)
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

16 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/ext/array_allocator.h
libstdc++-v3/include/ext/bitmap_allocator.h
libstdc++-v3/include/ext/malloc_allocator.h
libstdc++-v3/include/ext/mt_allocator.h
libstdc++-v3/include/ext/new_allocator.h
libstdc++-v3/include/ext/pool_allocator.h
libstdc++-v3/include/ext/throw_allocator.h
libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc [new file with mode: 0644]
libstdc++-v3/testsuite/util/testsuite_allocator.h

index 5ff48044211cd6b6a1a127d302ec73341e8906c5..820e03bef9138815b7cdc24ce79feda4bbcbe842 100644 (file)
@@ -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.
index 0bbd97a2d09492f8943d9bdf6c3231e007e4454f..d5f7092374300a49e21fb6e5068e24deef5ff149 100644 (file)
@@ -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(); }
index 93fa8e63ad538489246fecd9427814a06e04bcb1..91f5b149cd8b762a2fc37627d4a600c089947daf 100644 (file)
@@ -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)
index 531045b632538aa6ce8670a3e4c35f23ede97c72..a5d31684e8e72763cab334c9a32c64e09026b72b 100644 (file)
@@ -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(); }
index 6083cdb9c250573cfa7a02d5d12b49a666e3285c..425a485d5471417d130fa1e93506b6af27d34df3 100644 (file)
@@ -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(); }
index 938783c4b1e49146c704fe1a21c4f0ea229d69af..14f1de91b0f92307e6ce03d21f2f6e71e374960e 100644 (file)
@@ -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(); }
index f9dcc7fc88db76a536ca54f8bf9be9708467449d..3259d983adc49d1b7b6e6f86dce587db04be18ea 100644 (file)
@@ -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(); }
index 78b78f138c000462b38212bff16bb041bcfc52e0..f6d0b29428ea805c68cf8f49a62249b94dc035e5 100644 (file)
@@ -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 (file)
index 0000000..5c3f9a5
--- /dev/null
@@ -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 (file)
index 0000000..4e911e1
--- /dev/null
@@ -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 (file)
index 0000000..39163c8
--- /dev/null
@@ -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 (file)
index 0000000..8416c68
--- /dev/null
@@ -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 (file)
index 0000000..575e237
--- /dev/null
@@ -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 (file)
index 0000000..7d453b6
--- /dev/null
@@ -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 (file)
index 0000000..66766d0
--- /dev/null
@@ -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;
+}
index d6108cc60648f3ba6e42bf31a30f1d8b91718147..d162e21919c1a96a509d0f908b903e19875dedfb 100644 (file)
@@ -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(); }