re PR libstdc++/52702 ([C++11] std::is_trivially_destructible is missing)

2012-04-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/52702
	* include/std/type_traits (is_trivially_destructible): Add.
	(has_trivial_destructor): Remove.
	* testsuite/util/testsuite_common_types.h: Adjust.
	* testsuite/20_util/tuple/requirements/dr801.cc: Likewise.
	* testsuite/20_util/pair/requirements/dr801.cc: Likewise.
	* testsuite/20_util/is_trivially_destructible/value.cc: New.
	* testsuite/20_util/is_trivially_destructible/requirements/
	typedefs.cc: Likewise.
	* testsuite/20_util/is_trivially_destructible/requirements/
	explicit_instantiation.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: r186474
This commit is contained in:
Paolo Carlini 2012-04-15 23:35:27 +00:00 committed by Paolo Carlini
parent a3ddb73883
commit 6a9ecd3492
11 changed files with 179 additions and 31 deletions

View File

@ -1,3 +1,22 @@
2012-04-15 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/52702
* include/std/type_traits (is_trivially_destructible): Add.
(has_trivial_destructor): Remove.
* testsuite/util/testsuite_common_types.h: Adjust.
* testsuite/20_util/tuple/requirements/dr801.cc: Likewise.
* testsuite/20_util/pair/requirements/dr801.cc: Likewise.
* testsuite/20_util/is_trivially_destructible/value.cc: New.
* testsuite/20_util/is_trivially_destructible/requirements/
typedefs.cc: Likewise.
* testsuite/20_util/is_trivially_destructible/requirements/
explicit_instantiation.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-14 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/52699

View File

@ -1147,30 +1147,45 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __is_nt_move_assignable_impl<_Tp>
{ };
/// has_trivial_default_constructor
/// is_trivially_constructible (still unimplemented)
/// is_trivially_default_constructible (still unimplemented)
/// is_trivially_copy_constructible (still unimplemented)
/// is_trivially_move_constructible (still unimplemented)
/// is_trivially_assignable (still unimplemented)
/// is_trivially_copy_assignable (still unimplemented)
/// is_trivially_move_assignable (still unimplemented)
/// is_trivially_destructible
template<typename _Tp>
struct is_trivially_destructible
: public __and_<is_destructible<_Tp>, integral_constant<bool,
__has_trivial_destructor(_Tp)>>::type
{ };
/// has_trivial_default_constructor (temporary legacy)
template<typename _Tp>
struct has_trivial_default_constructor
: public integral_constant<bool, __has_trivial_constructor(_Tp)>
{ };
/// has_trivial_copy_constructor
/// has_trivial_copy_constructor (temporary legacy)
template<typename _Tp>
struct has_trivial_copy_constructor
: public integral_constant<bool, __has_trivial_copy(_Tp)>
{ };
/// has_trivial_copy_assign
/// has_trivial_copy_assign (temporary legacy)
template<typename _Tp>
struct has_trivial_copy_assign
: public integral_constant<bool, __has_trivial_assign(_Tp)>
{ };
/// has_trivial_destructor
template<typename _Tp>
struct has_trivial_destructor
: public integral_constant<bool, __has_trivial_destructor(_Tp)>
{ };
/// has_virtual_destructor
template<typename _Tp>
struct has_virtual_destructor

View File

@ -2,7 +2,7 @@
// { dg-do compile }
// 2009-11-12 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 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
@ -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 *-*-* } 1777 }
// { dg-error "static assertion failed" "" { target *-*-* } 1792 }
#include <utility>

View File

@ -0,0 +1,31 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// 2012-04-15 Paolo Carlini <paolo.carlini@oracle.com>
//
// 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_trivially_destructible<test_type>;
}

View File

@ -0,0 +1,37 @@
// { dg-options "-std=gnu++11" }
//
// 2012-04-15 Paolo Carlini <paolo.carlini@oracle.com>
//
// 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_trivially_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,44 @@
// { dg-options "-std=gnu++11" }
//
// 2012-04-15 Paolo Carlini <paolo.carlini@oracle.com>
//
// 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 <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_trivially_destructible;
using namespace __gnu_test;
VERIFY( (test_category<is_trivially_destructible, int>(true)) );
VERIFY( (test_category<is_trivially_destructible, TType>(true)) );
VERIFY( (test_category<is_trivially_destructible, PODType>(true)) );
VERIFY( (test_category<is_trivially_destructible, NType>(false)) );
VERIFY( (test_category<is_trivially_destructible, SLType>(false)) );
}
int main()
{
test01();
return 0;
}

View File

@ -3,7 +3,8 @@
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
//
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// Copyright (C) 2007, 2008, 2009, 2010, 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
@ -42,11 +43,11 @@ void test01()
typedef make_signed<float>::type test5_type;
}
// { dg-error "does not name a type" "" { target *-*-* } 33 }
// { dg-error "required from here" "" { target *-*-* } 35 }
// { dg-error "required from here" "" { target *-*-* } 37 }
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
// { dg-error "does not name a type" "" { target *-*-* } 34 }
// { dg-error "required from here" "" { target *-*-* } 36 }
// { dg-error "required from here" "" { target *-*-* } 38 }
// { dg-error "required from here" "" { target *-*-* } 41 }
// { dg-error "required from here" "" { target *-*-* } 43 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1566 }
// { dg-error "declaration of" "" { target *-*-* } 1530 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1581 }
// { dg-error "declaration of" "" { target *-*-* } 1545 }

View File

@ -3,7 +3,8 @@
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
//
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// Copyright (C) 2007, 2008, 2009, 2010, 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
@ -42,11 +43,11 @@ void test01()
typedef make_unsigned<float>::type test5_type;
}
// { dg-error "does not name a type" "" { target *-*-* } 33 }
// { dg-error "required from here" "" { target *-*-* } 35 }
// { dg-error "required from here" "" { target *-*-* } 37 }
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
// { dg-error "does not name a type" "" { target *-*-* } 34 }
// { dg-error "required from here" "" { target *-*-* } 36 }
// { dg-error "required from here" "" { target *-*-* } 38 }
// { dg-error "required from here" "" { target *-*-* } 41 }
// { dg-error "required from here" "" { target *-*-* } 43 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1484 }
// { dg-error "declaration of" "" { target *-*-* } 1448 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1499 }
// { dg-error "declaration of" "" { target *-*-* } 1463 }

View File

@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2010 Free Software Foundation, Inc.
// Copyright (C) 2010, 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
@ -29,7 +29,7 @@ void test_trivial()
// static_assert(std::is_literal_type<pair_type>::value, "! literal");
static_assert(std::has_trivial_copy_constructor<pair_type>::value,
"! triv copy");
static_assert(std::has_trivial_destructor<pair_type>::value,
static_assert(std::is_trivially_destructible<pair_type>::value,
"! triv destructor");
// static_assert(std::is_standard_layout<pair_type>::value,
// "! standard layout");

View File

@ -29,7 +29,7 @@ void test_trivial()
// static_assert(std::is_literal_type<tuple_type>::value, "! literal");
static_assert(std::has_trivial_copy_constructor<tuple_type>::value,
"! triv copy");
static_assert(std::has_trivial_destructor<tuple_type>::value,
static_assert(std::is_trivially_destructible<tuple_type>::value,
"! triv destructor");
// static_assert(std::is_standard_layout<tuple_type>::value,
// "! standard layout");

View File

@ -549,7 +549,7 @@ namespace __gnu_test
typedef std::has_trivial_default_constructor<_Tp> ctor_p;
static_assert(ctor_p::value, "default constructor not trivial");
typedef std::has_trivial_destructor<_Tp> dtor_p;
typedef std::is_trivially_destructible<_Tp> dtor_p;
static_assert(dtor_p::value, "destructor not trivial");
}
};