type_traits (is_nothrow_destructible): Implement.

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.

From-SVN: r186726
This commit is contained in:
Daniel Krugler 2012-04-23 21:34:06 +00:00 committed by Paolo Carlini
parent 025735b738
commit 62fa805ffa
12 changed files with 451 additions and 74 deletions

View File

@ -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

View File

@ -594,33 +594,12 @@ _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
{
template<typename _Up>
struct __w { _Up __u; };
template<typename _Tp, typename
= decltype(declval<__w<_Tp>&>().~__w<_Tp>())>
static true_type __test(int);
template<typename>
static false_type __test(...);
};
template<typename _Tp>
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<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
static true_type __test(int);
@ -630,23 +609,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _Tp>
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<typename _Tp,
bool = __or_<is_void<_Tp>,
__is_array_unknown_bounds<_Tp>>::value,
bool = __or_<is_reference<_Tp>, is_function<_Tp>>::value>
__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 conditional<is_abstract<_Tp>::value,
__is_destructible_impl_2<_Tp>,
__is_destructible_impl_1<_Tp>>::type::type
: public __is_destructible_impl<typename
remove_all_extents<_Tp>::type>::type
{ };
template<typename _Tp>
@ -663,6 +642,54 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: 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>
static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())>
__test(int);
template<typename>
static false_type __test(...);
};
template<typename _Tp>
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>,
is_function<_Tp>>::value,
bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
struct __is_nt_destructible_safe;
template<typename _Tp>
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_nt_destructible_safe<_Tp, true, false>
: public false_type { };
template<typename _Tp>
struct __is_nt_destructible_safe<_Tp, false, true>
: public true_type { };
/// is_nothrow_destructible
template<typename _Tp>
struct is_nothrow_destructible
: public integral_constant<bool, (__is_nt_destructible_safe<_Tp>::value)>
{ };
struct __do_is_default_constructible_impl
{
template<typename _Tp, typename = decltype(_Tp())>

View File

@ -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>

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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>;
}

View File

@ -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;
}

View File

@ -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");

View File

@ -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 }

View File

@ -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 }

View File

@ -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 {};