From 62fa805ffa7ed1794662a00ff0871ebb6e568a80 Mon Sep 17 00:00:00 2001 From: Daniel Krugler Date: Mon, 23 Apr 2012 21:34:06 +0000 Subject: [PATCH] type_traits (is_nothrow_destructible): Implement. 2012-04-23 Daniel Krugler * 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. From-SVN: r186726 --- libstdc++-v3/ChangeLog | 18 +++ libstdc++-v3/include/std/type_traits | 91 +++++++---- .../20_util/declval/requirements/1_neg.cc | 2 +- .../20_util/is_constructible/value-2.cc | 6 +- .../20_util/is_default_constructible/value.cc | 4 +- .../20_util/is_destructible/value.cc | 66 ++++---- .../requirements/explicit_instantiation.cc | 29 ++++ .../requirements/typedefs.cc | 36 +++++ .../20_util/is_nothrow_destructible/value.cc | 112 +++++++++++++ .../make_signed/requirements/typedefs_neg.cc | 4 +- .../requirements/typedefs_neg.cc | 4 +- libstdc++-v3/testsuite/util/testsuite_tr1.h | 153 +++++++++++++++++- 12 files changed, 451 insertions(+), 74 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_destructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_destructible/value.cc 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 + + * 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 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,33 +594,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public __and_, __not_>>::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 - { - template - struct __w { _Up __u; }; - - template&>().~__w<_Tp>())> - static true_type __test(int); - - template - static false_type __test(...); - }; - - template - struct __is_destructible_impl_1 - : public __do_is_destructible_impl_1 - { - typedef decltype(__test<_Tp>(0)) type; - }; - - // Special implementation for abstract types - struct __do_is_destructible_impl_2 + struct __do_is_destructible_impl { template().~_Tp())> static true_type __test(int); @@ -630,23 +609,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template - struct __is_destructible_impl_2 - : public __do_is_destructible_impl_2 + struct __is_destructible_impl + : public __do_is_destructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template, - __is_array_unknown_bounds<_Tp>>::value, - bool = __or_, is_function<_Tp>>::value> + __is_array_unknown_bounds<_Tp>, + is_function<_Tp>>::value, + bool = __or_, is_scalar<_Tp>>::value> struct __is_destructible_safe; template struct __is_destructible_safe<_Tp, false, false> - : public conditional::value, - __is_destructible_impl_2<_Tp>, - __is_destructible_impl_1<_Tp>>::type::type + : public __is_destructible_impl::type>::type { }; template @@ -663,6 +642,54 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant::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 + static integral_constant().~_Tp())> + __test(int); + + template + static false_type __test(...); + }; + + template + struct __is_nt_destructible_impl + : public __do_is_nt_destructible_impl + { + typedef decltype(__test<_Tp>(0)) type; + }; + + template, + __is_array_unknown_bounds<_Tp>, + is_function<_Tp>>::value, + bool = __or_, is_scalar<_Tp>>::value> + struct __is_nt_destructible_safe; + + template + struct __is_nt_destructible_safe<_Tp, false, false> + : public __is_nt_destructible_impl::type>::type + { }; + + template + struct __is_nt_destructible_safe<_Tp, true, false> + : public false_type { }; + + template + struct __is_nt_destructible_safe<_Tp, false, true> + : public true_type { }; + + /// is_nothrow_destructible + template + struct is_nothrow_destructible + : public integral_constant::value)> + { }; + struct __do_is_default_constructible_impl { template 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 // . -// { dg-error "static assertion failed" "" { target *-*-* } 1786 } +// { dg-error "static assertion failed" "" { target *-*-* } 1813 } #include 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 #include -using namespace __gnu_test::construct_destruct; +using namespace __gnu_test::construct; static_assert(std::is_constructible::value, "Error"); static_assert(std::is_constructible::value, @@ -753,7 +753,7 @@ static_assert(!std::is_constructible&, static_assert(!std::is_constructible>, int, int>::value, "Error"); -static_assert(!std::is_constructible>, int, int>::value, "Error"); static_assert(!std::is_constructible::value, "Error"); static_assert(!std::is_constructible::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 #include -using namespace __gnu_test::construct_destruct; +using namespace __gnu_test::construct; static_assert(std::is_default_constructible::value, "Error"); static_assert(std::is_default_constructible::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 #include -using namespace __gnu_test::construct_destruct; +using namespace __gnu_test::destruct; static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); @@ -30,41 +30,45 @@ static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); static_assert(std::is_destructible::value, "Error"); @@ -75,23 +79,25 @@ static_assert(std::is_destructible>::value, "Error"); static_assert(std::is_destructible>::value, "Error"); -static_assert(std::is_destructible::value, "Error"); -static_assert(std::is_destructible::value, "Error"); +static_assert(std::is_destructible>::value, + "Error"); static_assert(!std::is_destructible::value, "Error"); static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); static_assert(!std::is_destructible::value, "Error"); static_assert(!std::is_destructible::value, "Error"); -static_assert(!std::is_destructible::value, "Error"); -static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); static_assert(!std::is_destructible::value, "Error"); static_assert(!std::is_destructible::value, "Error"); static_assert(!std::is_destructible::value, "Error"); static_assert(!std::is_destructible::value, "Error"); -static_assert(!std::is_destructible::value, "Error"); -static_assert(!std::is_destructible::value, "Error"); -static_assert(!std::is_destructible::value, "Error"); -static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); +static_assert(!std::is_destructible::value, "Error"); // Deleted members in unions with non-trivial members: static_assert(!std::is_destructible::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 +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_nothrow_destructible; +} 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 +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::is_nothrow_destructible 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 +// . + +#include +#include +#include + +using namespace __gnu_test::destruct; + +// is_nothrow_destructible: +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible>::value, "Error"); +static_assert(std::is_nothrow_destructible>::value, "Error"); +static_assert(std::is_nothrow_destructible>::value, "Error"); +static_assert(std::is_nothrow_destructible>::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); +static_assert(std::is_nothrow_destructible::value, "Error"); + +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::value, "Error"); +static_assert(!std::is_nothrow_destructible::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 {};