summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-23 21:34:06 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-23 21:34:06 +0000
commitbe39fa57654cc3d8f31a004375149c75adab65a8 (patch)
tree7d8657c51c9ac736f522f44992985b70428b2aaa /libstdc++-v3
parenta110769b0594fd6dee203e6aad8a5d9095e73aa7 (diff)
downloadgcc-be39fa57654cc3d8f31a004375149c75adab65a8.tar.gz
2012-04-23 Daniel Krugler <daniel.kruegler@googlemail.com>
* include/std/type_traits (is_nothrow_destructible): Implement. (is_destructible): Implement LWG 2049. * testsuite/util/testsuite_tr1.h: Add tests. * testsuite/20_util/is_nothrow_destructible/value.cc: New. * testsuite/20_util/is_nothrow_destructible/requirements/typedefs.cc: * testsuite/20_util/is_nothrow_destructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_destructible/value.cc: Adjust and extend. * testsuite/20_util/is_default_constructible/value.cc: Tweak. * testsuite/20_util/is_constructible/value-2.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186726 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog18
-rw-r--r--libstdc++-v3/include/std/type_traits85
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc6
-rw-r--r--libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/is_destructible/value.cc66
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/explicit_instantiation.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_destructible/value.cc112
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_tr1.h153
12 files changed, 448 insertions, 71 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b47289ea75b..0c08c091dd3 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,21 @@
+2012-04-23 Daniel Krugler <daniel.kruegler@googlemail.com>
+
+ * include/std/type_traits (is_nothrow_destructible): Implement.
+ (is_destructible): Implement LWG 2049.
+ * testsuite/util/testsuite_tr1.h: Add tests.
+ * testsuite/20_util/is_nothrow_destructible/value.cc: New.
+ * testsuite/20_util/is_nothrow_destructible/requirements/typedefs.cc:
+ * testsuite/20_util/is_nothrow_destructible/requirements/
+ explicit_instantiation.cc: Likewise.
+ * testsuite/20_util/is_destructible/value.cc: Adjust and extend.
+ * testsuite/20_util/is_default_constructible/value.cc: Tweak.
+ * testsuite/20_util/is_constructible/value-2.cc: Likewise.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
+ dg-error line numbers.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
+
2012-04-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/53080
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index c03b7bd64bb..9232af7934c 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -594,18 +594,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __and_<is_array<_Tp>, __not_<extent<_Tp>>>::type
{ };
- // In N3290 is_destructible does not say anything about function
+ // In N3290 is_destructible does not say anything about function
// types and abstract types, see LWG 2049. This implementation
- // describes function types as trivially nothrow destructible and
- // abstract types as destructible, iff the explicit destructor
+ // describes function types as non-destructible and all complete
+ // object types as destructible, iff the explicit destructor
// call expression is wellformed.
- struct __do_is_destructible_impl_1
+ struct __do_is_destructible_impl
{
- template<typename _Up>
- struct __w { _Up __u; };
-
- template<typename _Tp, typename
- = decltype(declval<__w<_Tp>&>().~__w<_Tp>())>
+ template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
static true_type __test(int);
template<typename>
@@ -613,54 +609,85 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _Tp>
- struct __is_destructible_impl_1
- : public __do_is_destructible_impl_1
+ struct __is_destructible_impl
+ : public __do_is_destructible_impl
{
typedef decltype(__test<_Tp>(0)) type;
};
- // Special implementation for abstract types
- struct __do_is_destructible_impl_2
+ template<typename _Tp,
+ bool = __or_<is_void<_Tp>,
+ __is_array_unknown_bounds<_Tp>,
+ is_function<_Tp>>::value,
+ bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
+ struct __is_destructible_safe;
+
+ template<typename _Tp>
+ struct __is_destructible_safe<_Tp, false, false>
+ : public __is_destructible_impl<typename
+ remove_all_extents<_Tp>::type>::type
+ { };
+
+ template<typename _Tp>
+ struct __is_destructible_safe<_Tp, true, false>
+ : public false_type { };
+
+ template<typename _Tp>
+ struct __is_destructible_safe<_Tp, false, true>
+ : public true_type { };
+
+ /// is_destructible
+ template<typename _Tp>
+ struct is_destructible
+ : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)>
+ { };
+
+ // is_nothrow_destructible requires that is_destructible is
+ // satisfied as well. We realize that by mimicing the
+ // implementation of is_destructible but refer to noexcept(expr)
+ // instead of decltype(expr).
+ struct __do_is_nt_destructible_impl
{
- template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
- static true_type __test(int);
+ template<typename _Tp>
+ static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())>
+ __test(int);
template<typename>
static false_type __test(...);
};
template<typename _Tp>
- struct __is_destructible_impl_2
- : public __do_is_destructible_impl_2
+ struct __is_nt_destructible_impl
+ : public __do_is_nt_destructible_impl
{
typedef decltype(__test<_Tp>(0)) type;
};
template<typename _Tp,
bool = __or_<is_void<_Tp>,
- __is_array_unknown_bounds<_Tp>>::value,
- bool = __or_<is_reference<_Tp>, is_function<_Tp>>::value>
- struct __is_destructible_safe;
+ __is_array_unknown_bounds<_Tp>,
+ is_function<_Tp>>::value,
+ bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
+ struct __is_nt_destructible_safe;
template<typename _Tp>
- struct __is_destructible_safe<_Tp, false, false>
- : public conditional<is_abstract<_Tp>::value,
- __is_destructible_impl_2<_Tp>,
- __is_destructible_impl_1<_Tp>>::type::type
+ struct __is_nt_destructible_safe<_Tp, false, false>
+ : public __is_nt_destructible_impl<typename
+ remove_all_extents<_Tp>::type>::type
{ };
template<typename _Tp>
- struct __is_destructible_safe<_Tp, true, false>
+ struct __is_nt_destructible_safe<_Tp, true, false>
: public false_type { };
template<typename _Tp>
- struct __is_destructible_safe<_Tp, false, true>
+ struct __is_nt_destructible_safe<_Tp, false, true>
: public true_type { };
- /// is_destructible
+ /// is_nothrow_destructible
template<typename _Tp>
- struct is_destructible
- : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)>
+ struct is_nothrow_destructible
+ : public integral_constant<bool, (__is_nt_destructible_safe<_Tp>::value)>
{ };
struct __do_is_default_constructible_impl
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index 0839e246df3..2b6757efd69 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 1786 }
+// { dg-error "static assertion failed" "" { target *-*-* } 1813 }
#include <utility>
diff --git a/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc b/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
index 06895e32bb0..5bd0520fcda 100644
--- a/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
+++ b/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2011, 2012 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
@@ -22,7 +22,7 @@
#include <initializer_list>
#include <testsuite_tr1.h>
-using namespace __gnu_test::construct_destruct;
+using namespace __gnu_test::construct;
static_assert(std::is_constructible<int, int>::value, "Error");
static_assert(std::is_constructible<std::nullptr_t, std::nullptr_t>::value,
@@ -753,7 +753,7 @@ static_assert(!std::is_constructible<FromArgs<std::initializer_list<int>&,
static_assert(!std::is_constructible<FromArgs<std::initializer_list<int>>,
int, int>::value, "Error");
-static_assert(!std::is_constructible<const
+static_assert(!std::is_constructible<const
FromArgs<std::initializer_list<int>>, int, int>::value, "Error");
static_assert(!std::is_constructible<B[2], B, B>::value, "Error");
static_assert(!std::is_constructible<const B[2], B, B>::value, "Error");
diff --git a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc
index 6461cb7d5fe..979e421587b 100644
--- a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2011, 2012 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
@@ -22,7 +22,7 @@
#include <initializer_list>
#include <testsuite_tr1.h>
-using namespace __gnu_test::construct_destruct;
+using namespace __gnu_test::construct;
static_assert(std::is_default_constructible<int>::value, "Error");
static_assert(std::is_default_constructible<int const>::value, "Error");
diff --git a/libstdc++-v3/testsuite/20_util/is_destructible/value.cc b/libstdc++-v3/testsuite/20_util/is_destructible/value.cc
index b0382c6e83d..b6b2b31fa29 100644
--- a/libstdc++-v3/testsuite/20_util/is_destructible/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_destructible/value.cc
@@ -1,7 +1,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2011, 2012 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
@@ -22,7 +22,7 @@
#include <initializer_list>
#include <testsuite_tr1.h>
-using namespace __gnu_test::construct_destruct;
+using namespace __gnu_test::destruct;
static_assert(std::is_destructible<int>::value, "Error");
static_assert(std::is_destructible<const int>::value, "Error");
@@ -30,41 +30,45 @@ static_assert(std::is_destructible<bool>::value, "Error");
static_assert(std::is_destructible<const bool>::value, "Error");
static_assert(std::is_destructible<int*>::value, "Error");
static_assert(std::is_destructible<void*>::value, "Error");
-static_assert(std::is_destructible<int B::*>::value, "Error");
-static_assert(std::is_destructible<const int D::*>::value, "Error");
-static_assert(std::is_destructible<E>::value, "Error");
-static_assert(std::is_destructible<const E>::value, "Error");
-static_assert(std::is_destructible<SE>::value, "Error");
-static_assert(std::is_destructible<const SE>::value, "Error");
+static_assert(std::is_destructible<int Der::*>::value, "Error");
+static_assert(std::is_destructible<const int Der::*>::value, "Error");
+static_assert(std::is_destructible<void (Der::*)() const>::value, "Error");
+static_assert(std::is_destructible<void(*)()>::value, "Error");
+static_assert(std::is_destructible<En>::value, "Error");
+static_assert(std::is_destructible<const En>::value, "Error");
+static_assert(std::is_destructible<En2>::value, "Error");
+static_assert(std::is_destructible<const En2>::value, "Error");
static_assert(std::is_destructible<OpE>::value, "Error");
static_assert(std::is_destructible<const OpE>::value, "Error");
static_assert(std::is_destructible<OpSE>::value, "Error");
static_assert(std::is_destructible<const OpSE>::value, "Error");
static_assert(std::is_destructible<std::nullptr_t>::value, "Error");
static_assert(std::is_destructible<const std::nullptr_t>::value, "Error");
-static_assert(std::is_destructible<B>::value, "Error");
-static_assert(std::is_destructible<const B>::value, "Error");
-static_assert(std::is_destructible<D>::value, "Error");
-static_assert(std::is_destructible<const D>::value, "Error");
-static_assert(std::is_destructible<Empty>::value, "Error");
-static_assert(std::is_destructible<const Empty>::value, "Error");
-static_assert(std::is_destructible<U>::value, "Error");
-static_assert(std::is_destructible<const U>::value, "Error");
-static_assert(std::is_destructible<Abstract>::value, "Error");
-static_assert(std::is_destructible<const Abstract>::value, "Error");
+static_assert(std::is_destructible<Der>::value, "Error");
+static_assert(std::is_destructible<const Der>::value, "Error");
+static_assert(std::is_destructible<Aggr>::value, "Error");
+static_assert(std::is_destructible<const Aggr>::value, "Error");
+static_assert(std::is_destructible<E>::value, "Error");
+static_assert(std::is_destructible<const E>::value, "Error");
+static_assert(std::is_destructible<U1>::value, "Error");
+static_assert(std::is_destructible<const U1>::value, "Error");
+static_assert(std::is_destructible<Abstract1>::value, "Error");
+static_assert(std::is_destructible<const Abstract1>::value, "Error");
static_assert(std::is_destructible<int[1]>::value, "Error");
static_assert(std::is_destructible<const int[1]>::value, "Error");
static_assert(std::is_destructible<int[1][2]>::value, "Error");
static_assert(std::is_destructible<const int[1][2]>::value, "Error");
static_assert(std::is_destructible<int&>::value, "Error");
static_assert(std::is_destructible<int&&>::value, "Error");
+static_assert(std::is_destructible<int(&)[1]>::value, "Error");
+static_assert(std::is_destructible<const int(&)[1]>::value, "Error");
static_assert(std::is_destructible<void(&)()>::value, "Error");
static_assert(std::is_destructible<Ellipsis>::value, "Error");
static_assert(std::is_destructible<const Ellipsis>::value, "Error");
-static_assert(std::is_destructible<Any>::value, "Error");
-static_assert(std::is_destructible<const Any>::value, "Error");
-static_assert(std::is_destructible<nAny>::value, "Error");
-static_assert(std::is_destructible<const nAny>::value, "Error");
+static_assert(std::is_destructible<Abstract2>::value, "Error");
+static_assert(std::is_destructible<const Abstract2>::value, "Error");
+static_assert(std::is_destructible<Aggr2>::value, "Error");
+static_assert(std::is_destructible<const Aggr2>::value, "Error");
static_assert(std::is_destructible<DelDef>::value, "Error");
static_assert(std::is_destructible<const DelDef>::value, "Error");
static_assert(std::is_destructible<DelCopy>::value, "Error");
@@ -75,23 +79,25 @@ static_assert(std::is_destructible<std::initializer_list<int>>::value,
"Error");
static_assert(std::is_destructible<const std::initializer_list<int>>::value,
"Error");
-static_assert(std::is_destructible<void()>::value, "Error");
-static_assert(std::is_destructible<void() const>::value, "Error");
+static_assert(std::is_destructible<std::initializer_list<Del>>::value,
+ "Error");
static_assert(!std::is_destructible<void>::value, "Error");
static_assert(!std::is_destructible<const void>::value, "Error");
+static_assert(!std::is_destructible<void()>::value, "Error");
+static_assert(!std::is_destructible<void() const>::value, "Error");
static_assert(!std::is_destructible<int[]>::value, "Error");
static_assert(!std::is_destructible<const int[]>::value, "Error");
-static_assert(!std::is_destructible<DelDtor>::value, "Error");
-static_assert(!std::is_destructible<const DelDtor>::value, "Error");
+static_assert(!std::is_destructible<Del>::value, "Error");
+static_assert(!std::is_destructible<const Del>::value, "Error");
static_assert(!std::is_destructible<AbstractDelDtor>::value, "Error");
static_assert(!std::is_destructible<const AbstractDelDtor>::value, "Error");
static_assert(!std::is_destructible<int[][1]>::value, "Error");
static_assert(!std::is_destructible<const int[][1]>::value, "Error");
-static_assert(!std::is_destructible<DelDtor[1]>::value, "Error");
-static_assert(!std::is_destructible<const DelDtor[1]>::value, "Error");
-static_assert(!std::is_destructible<DelDtor[]>::value, "Error");
-static_assert(!std::is_destructible<const DelDtor[]>::value, "Error");
+static_assert(!std::is_destructible<Del[1]>::value, "Error");
+static_assert(!std::is_destructible<const Del[1]>::value, "Error");
+static_assert(!std::is_destructible<Del[]>::value, "Error");
+static_assert(!std::is_destructible<const Del[]>::value, "Error");
// Deleted members in unions with non-trivial members:
static_assert(!std::is_destructible<NontrivialUnion>::value, "Error");
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..3b43f919322
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/explicit_instantiation.cc
@@ -0,0 +1,29 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2012 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+ typedef short test_type;
+ template struct is_nothrow_destructible<test_type>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/typedefs.cc
new file mode 100644
index 00000000000..c2343fa82cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2012 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+//
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::is_nothrow_destructible<int> test_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::type type;
+ typedef test_type::type::value_type type_value_type;
+ typedef test_type::type::type type_type;
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/value.cc
new file mode 100644
index 00000000000..af9771915a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_destructible/value.cc
@@ -0,0 +1,112 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2012 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <type_traits>
+#include <initializer_list>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test::destruct;
+
+// is_nothrow_destructible:
+static_assert(std::is_nothrow_destructible<int>::value, "Error");
+static_assert(std::is_nothrow_destructible<const int>::value, "Error");
+static_assert(std::is_nothrow_destructible<const volatile int>::value, "Error");
+static_assert(std::is_nothrow_destructible<int[12]>::value, "Error");
+static_assert(std::is_nothrow_destructible<const int[12]>::value, "Error");
+static_assert(std::is_nothrow_destructible<const volatile int[12]>::value, "Error");
+static_assert(std::is_nothrow_destructible<decltype(nullptr)>::value, "Error");
+static_assert(std::is_nothrow_destructible<std::initializer_list<int>>::value, "Error");
+static_assert(std::is_nothrow_destructible<std::initializer_list<decltype(nullptr)>>::value, "Error");
+static_assert(std::is_nothrow_destructible<std::initializer_list<TD1>>::value, "Error");
+static_assert(std::is_nothrow_destructible<std::initializer_list<TD2>>::value, "Error");
+static_assert(std::is_nothrow_destructible<E>::value, "Error");
+static_assert(std::is_nothrow_destructible<const E>::value, "Error");
+static_assert(std::is_nothrow_destructible<const volatile E>::value, "Error");
+static_assert(std::is_nothrow_destructible<NTD1>::value, "Error");
+static_assert(std::is_nothrow_destructible<NTD2>::value, "Error");
+static_assert(std::is_nothrow_destructible<NTD3>::value, "Error");
+static_assert(std::is_nothrow_destructible<Aggr>::value, "Error");
+static_assert(std::is_nothrow_destructible<U1>::value, "Error");
+static_assert(std::is_nothrow_destructible<void(*)()>::value, "Error");
+static_assert(std::is_nothrow_destructible<void*>::value, "Error");
+static_assert(std::is_nothrow_destructible<int&>::value, "Error");
+static_assert(std::is_nothrow_destructible<TD1&>::value, "Error");
+static_assert(std::is_nothrow_destructible<TD2&>::value, "Error");
+static_assert(std::is_nothrow_destructible<TD1*>::value, "Error");
+static_assert(std::is_nothrow_destructible<TD2*>::value, "Error");
+static_assert(std::is_nothrow_destructible<void(&)()>::value, "Error");
+static_assert(std::is_nothrow_destructible<void(&&)()>::value, "Error");
+static_assert(std::is_nothrow_destructible<En>::value, "Error");
+static_assert(std::is_nothrow_destructible<En*>::value, "Error");
+static_assert(std::is_nothrow_destructible<En&>::value, "Error");
+static_assert(std::is_nothrow_destructible<En2>::value, "Error");
+static_assert(std::is_nothrow_destructible<En2*>::value, "Error");
+static_assert(std::is_nothrow_destructible<En2&>::value, "Error");
+static_assert(std::is_nothrow_destructible<TD1(&)(Aggr2, TD2)>::value, "Error");
+static_assert(std::is_nothrow_destructible<TD1(*)(Aggr2, TD2)>::value, "Error");
+static_assert(std::is_nothrow_destructible<Abstract1>::value, "Error");
+static_assert(std::is_nothrow_destructible<Der>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del2&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del3&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del(&)[1]>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del2(&)[2]>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del3(&)[3]>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del&&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del2&&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del3&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del(&&)[1]>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del2(&&)[2]>::value, "Error");
+static_assert(std::is_nothrow_destructible<Del3(&&)[3]>::value, "Error");
+static_assert(std::is_nothrow_destructible<Ut&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Ut&&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Ut*>::value, "Error");
+static_assert(std::is_nothrow_destructible<Abstract2&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Abstract3&>::value, "Error");
+static_assert(std::is_nothrow_destructible<Abstract2*>::value, "Error");
+static_assert(std::is_nothrow_destructible<Abstract3*>::value, "Error");
+
+static_assert(!std::is_nothrow_destructible<void>::value, "Error");
+static_assert(!std::is_nothrow_destructible<const void>::value, "Error");
+static_assert(!std::is_nothrow_destructible<void()>::value, "Error");
+static_assert(!std::is_nothrow_destructible<void() const>::value, "Error");
+static_assert(!std::is_nothrow_destructible<TD1(Aggr2, TD2)>::value, "Error");
+static_assert(!std::is_nothrow_destructible<int[]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<const int[]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<const volatile int[]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<int[][123]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<TD1>::value, "Error");
+static_assert(!std::is_nothrow_destructible<TD2>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Aggr2>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Aggr2[1]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<TD1[1][2]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Ut>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Ut[3]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<AbstractDelDtor>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Abstract2>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Abstract3>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Der2>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Del>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Del2>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Del3>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Del[1]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Del2[2]>::value, "Error");
+static_assert(!std::is_nothrow_destructible<Del3[3]>::value, "Error");
+
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 09ab111b796..1c68fac6b6e 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -49,5 +49,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 41 }
// { dg-error "required from here" "" { target *-*-* } 43 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1575 }
-// { dg-error "declaration of" "" { target *-*-* } 1539 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1602 }
+// { dg-error "declaration of" "" { target *-*-* } 1566 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index 574a9bb05ca..a41e5e61a15 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -49,5 +49,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 41 }
// { dg-error "required from here" "" { target *-*-* } 43 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1493 }
-// { dg-error "declaration of" "" { target *-*-* } 1457 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1520 }
+// { dg-error "declaration of" "" { target *-*-* } 1484 }
diff --git a/libstdc++-v3/testsuite/util/testsuite_tr1.h b/libstdc++-v3/testsuite/util/testsuite_tr1.h
index 1452e3e9f88..083574e27ce 100644
--- a/libstdc++-v3/testsuite/util/testsuite_tr1.h
+++ b/libstdc++-v3/testsuite/util/testsuite_tr1.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// Testing utilities for the tr1 testsuite.
//
-// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -404,7 +404,7 @@ namespace __gnu_test
{ return true; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- namespace construct_destruct
+ namespace construct
{
struct Empty {};
@@ -526,6 +526,155 @@ namespace __gnu_test
};
}
+ namespace destruct
+ {
+ struct E
+ {};
+
+ struct NTD1
+ {
+ ~NTD1() = default;
+ };
+
+ struct NTD2
+ {
+ ~NTD2();
+ };
+
+ struct NTD3
+ {
+ ~NTD3() throw();
+ };
+
+ struct TD1
+ {
+ ~TD1() noexcept(false);
+ };
+
+ struct TD2
+ {
+ ~TD2() throw(int);
+ };
+
+ struct Aggr
+ {
+ int i;
+ bool b;
+ E e;
+ };
+
+ struct Aggr2
+ {
+ int i;
+ bool b;
+ TD1 r;
+ };
+
+ struct Del
+ {
+ ~Del() = delete;
+ };
+
+ struct Del2
+ {
+ ~Del2() noexcept = delete;
+ };
+
+ struct Del3
+ {
+ ~Del3() noexcept(false) = delete;
+ };
+
+ struct Der : Aggr
+ {};
+
+ struct Der2 : Aggr2
+ {};
+
+ union U1
+ {
+ int i;
+ double d;
+ void* p;
+ TD1* pt;
+ };
+
+ union Ut
+ {
+ int i;
+ double d;
+ void* p;
+ TD1 pt;
+ };
+
+ enum class En { a, b, c, d };
+ enum En2 { En2a, En2b, En2c, En2d };
+
+ enum OpE : int;
+ enum class OpSE : bool;
+
+ struct Abstract1
+ {
+ virtual ~Abstract1() = 0;
+ };
+
+ struct AbstractDelDtor
+ {
+ ~AbstractDelDtor() = delete;
+ virtual void foo() = 0;
+ };
+
+ struct Abstract2
+ {
+ virtual ~Abstract2() noexcept(false) = 0;
+ };
+
+ struct Abstract3
+ {
+ ~Abstract3() noexcept(false);
+ virtual void foo() noexcept = 0;
+ };
+
+ struct Nontrivial
+ {
+ Nontrivial();
+ Nontrivial(const Nontrivial&);
+ Nontrivial& operator=(const Nontrivial&);
+ ~Nontrivial();
+ };
+
+ union NontrivialUnion
+ {
+ int i;
+ Nontrivial n;
+ };
+
+ struct UnusualCopy
+ {
+ UnusualCopy(UnusualCopy&);
+ };
+
+ struct Ellipsis
+ {
+ Ellipsis(...){}
+ };
+
+ struct DelEllipsis
+ {
+ DelEllipsis(...) = delete;
+ };
+
+ struct DelDef
+ {
+ DelDef() = delete;
+ };
+
+ struct DelCopy
+ {
+ DelCopy(const DelCopy&) = delete;
+ };
+ }
+
namespace assign
{
struct Empty {};