type_traits (has_trivial_copy, [...]): Adjust according to the resolution of TR1 issue 3.21.

2005-04-27  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/type_traits (has_trivial_copy, has_trivial_assign,
	has_nothrow_copy, has_nothrow_assign): Adjust according to the
	resolution of TR1 issue 3.21.
	* testsuite/testsuite_tr1.h (test_copy_property,
	test_assign_property): Remove.
	* testsuite/tr1/4_metaprogramming/type_properties/
	has_nothrow_assign/has_nothrow_assign.cc: Adjust.
	* testsuite/tr1/4_metaprogramming/type_properties/
	has_nothrow_copy/has_nothrow_copy.cc: Likewise.
	* testsuite/tr1/4_metaprogramming/type_properties/
	has_trivial_assign/has_trivial_assign.cc: Likewise.
	* testsuite/tr1/4_metaprogramming/type_properties/
	has_trivial_copy/has_trivial_copy.cc: Likewise.

From-SVN: r98829
This commit is contained in:
Paolo Carlini 2005-04-27 15:08:57 +00:00 committed by Paolo Carlini
parent e3cc72542b
commit 4e5362a2a3
7 changed files with 84 additions and 116 deletions

View File

@ -1,3 +1,19 @@
2005-04-27 Paolo Carlini <pcarlini@suse.de>
* include/tr1/type_traits (has_trivial_copy, has_trivial_assign,
has_nothrow_copy, has_nothrow_assign): Adjust according to the
resolution of TR1 issue 3.21.
* testsuite/testsuite_tr1.h (test_copy_property,
test_assign_property): Remove.
* testsuite/tr1/4_metaprogramming/type_properties/
has_nothrow_assign/has_nothrow_assign.cc: Adjust.
* testsuite/tr1/4_metaprogramming/type_properties/
has_nothrow_copy/has_nothrow_copy.cc: Likewise.
* testsuite/tr1/4_metaprogramming/type_properties/
has_trivial_assign/has_trivial_assign.cc: Likewise.
* testsuite/tr1/4_metaprogramming/type_properties/
has_trivial_copy/has_trivial_copy.cc: Likewise.
2005-04-26 Jones Desougi <jones@ingate.com>
PR libstdc++/21131

View File

@ -366,14 +366,11 @@ namespace tr1
template<typename _Tp>
struct has_trivial_copy
: public integral_constant<bool, (is_pod<_Tp>::value
&& !is_volatile<_Tp>::value)> { };
: public integral_constant<bool, is_pod<_Tp>::value> { };
template<typename _Tp>
struct has_trivial_assign
: public integral_constant<bool, (is_pod<_Tp>::value
&& !is_const<_Tp>::value
&& !is_volatile<_Tp>::value)> { };
: public integral_constant<bool, is_pod<_Tp>::value> { };
template<typename _Tp>
struct has_trivial_destructor
@ -385,14 +382,11 @@ namespace tr1
template<typename _Tp>
struct has_nothrow_copy
: public integral_constant<bool, (is_pod<_Tp>::value
&& !is_volatile<_Tp>::value)> { };
: public integral_constant<bool, is_pod<_Tp>::value> { };
template<typename _Tp>
struct has_nothrow_assign
: public integral_constant<bool, (is_pod<_Tp>::value
&& !is_const<_Tp>::value
&& !is_volatile<_Tp>::value)> { };
: public integral_constant<bool, is_pod<_Tp>::value> { };
template<typename>
struct has_virtual_destructor

View File

@ -62,40 +62,6 @@ namespace __gnu_test
return ret;
}
template<template<typename> class Property,
typename Type>
bool
test_copy_property(bool value)
{
bool ret = true;
ret &= Property<Type>::value == value;
ret &= Property<const Type>::value == value;
ret &= Property<volatile Type>::value == !value;
ret &= Property<const volatile Type>::value == !value;
ret &= Property<Type>::type::value == value;
ret &= Property<const Type>::type::value == value;
ret &= Property<volatile Type>::type::value == !value;
ret &= Property<const volatile Type>::type::value == !value;
return ret;
}
template<template<typename> class Property,
typename Type>
bool
test_assign_property(bool value)
{
bool ret = true;
ret &= Property<Type>::value == value;
ret &= Property<const Type>::value == !value;
ret &= Property<volatile Type>::value == !value;
ret &= Property<const volatile Type>::value == !value;
ret &= Property<Type>::type::value == value;
ret &= Property<const Type>::type::value == !value;
ret &= Property<volatile Type>::type::value == !value;
ret &= Property<const volatile Type>::type::value == !value;
return ret;
}
template<template<typename, typename> class Relationship,
typename Type1, typename Type2>
bool

View File

@ -1,6 +1,6 @@
// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005 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
@ -30,23 +30,21 @@ void test01()
using std::tr1::has_nothrow_assign;
using namespace __gnu_test;
VERIFY( (test_assign_property<has_nothrow_assign, void>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, int>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, float>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, EnumType>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, int*>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, int(*)(int)>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, int (ClassType::*)>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, int[2]>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, float[][3]>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, EnumType[2][3][4]>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, int*[3]>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign, int(*[][2])(int)>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign,
int (ClassType::*[2][3])>(true)) );
VERIFY( (test_assign_property<has_nothrow_assign,
VERIFY( (test_category<has_nothrow_assign, void>(true)) );
VERIFY( (test_category<has_nothrow_assign, int>(true)) );
VERIFY( (test_category<has_nothrow_assign, float>(true)) );
VERIFY( (test_category<has_nothrow_assign, EnumType>(true)) );
VERIFY( (test_category<has_nothrow_assign, int*>(true)) );
VERIFY( (test_category<has_nothrow_assign, int(*)(int)>(true)) );
VERIFY( (test_category<has_nothrow_assign, int (ClassType::*)>(true)) );
VERIFY( (test_category<has_nothrow_assign, int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<has_nothrow_assign, int[2]>(true)) );
VERIFY( (test_category<has_nothrow_assign, float[][3]>(true)) );
VERIFY( (test_category<has_nothrow_assign, EnumType[2][3][4]>(true)) );
VERIFY( (test_category<has_nothrow_assign, int*[3]>(true)) );
VERIFY( (test_category<has_nothrow_assign, int(*[][2])(int)>(true)) );
VERIFY( (test_category<has_nothrow_assign, int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<has_nothrow_assign,
int (ClassType::*[][2][3]) (int)>(true)) );
}

View File

@ -1,6 +1,6 @@
// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005 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
@ -30,23 +30,21 @@ void test01()
using std::tr1::has_nothrow_copy;
using namespace __gnu_test;
VERIFY( (test_copy_property<has_nothrow_copy, void>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, int>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, float>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, EnumType>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, int*>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, int(*)(int)>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, int (ClassType::*)>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, int[2]>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, float[][3]>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, EnumType[2][3][4]>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, int*[3]>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy, int(*[][2])(int)>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy,
int (ClassType::*[2][3])>(true)) );
VERIFY( (test_copy_property<has_nothrow_copy,
VERIFY( (test_category<has_nothrow_copy, void>(true)) );
VERIFY( (test_category<has_nothrow_copy, int>(true)) );
VERIFY( (test_category<has_nothrow_copy, float>(true)) );
VERIFY( (test_category<has_nothrow_copy, EnumType>(true)) );
VERIFY( (test_category<has_nothrow_copy, int*>(true)) );
VERIFY( (test_category<has_nothrow_copy, int(*)(int)>(true)) );
VERIFY( (test_category<has_nothrow_copy, int (ClassType::*)>(true)) );
VERIFY( (test_category<has_nothrow_copy, int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<has_nothrow_copy, int[2]>(true)) );
VERIFY( (test_category<has_nothrow_copy, float[][3]>(true)) );
VERIFY( (test_category<has_nothrow_copy, EnumType[2][3][4]>(true)) );
VERIFY( (test_category<has_nothrow_copy, int*[3]>(true)) );
VERIFY( (test_category<has_nothrow_copy, int(*[][2])(int)>(true)) );
VERIFY( (test_category<has_nothrow_copy, int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<has_nothrow_copy,
int (ClassType::*[][2][3]) (int)>(true)) );
}

View File

@ -1,6 +1,6 @@
// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005 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
@ -30,23 +30,21 @@ void test01()
using std::tr1::has_trivial_assign;
using namespace __gnu_test;
VERIFY( (test_assign_property<has_trivial_assign, void>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, int>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, float>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, EnumType>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, int*>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, int(*)(int)>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, int (ClassType::*)>(true)) );
VERIFY( (test_assign_property<has_trivial_assign,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, int[2]>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, float[][3]>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, EnumType[2][3][4]>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, int*[3]>(true)) );
VERIFY( (test_assign_property<has_trivial_assign, int(*[][2])(int)>(true)) );
VERIFY( (test_assign_property<has_trivial_assign,
int (ClassType::*[2][3])>(true)) );
VERIFY( (test_assign_property<has_trivial_assign,
VERIFY( (test_category<has_trivial_assign, void>(true)) );
VERIFY( (test_category<has_trivial_assign, int>(true)) );
VERIFY( (test_category<has_trivial_assign, float>(true)) );
VERIFY( (test_category<has_trivial_assign, EnumType>(true)) );
VERIFY( (test_category<has_trivial_assign, int*>(true)) );
VERIFY( (test_category<has_trivial_assign, int(*)(int)>(true)) );
VERIFY( (test_category<has_trivial_assign, int (ClassType::*)>(true)) );
VERIFY( (test_category<has_trivial_assign, int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<has_trivial_assign, int[2]>(true)) );
VERIFY( (test_category<has_trivial_assign, float[][3]>(true)) );
VERIFY( (test_category<has_trivial_assign, EnumType[2][3][4]>(true)) );
VERIFY( (test_category<has_trivial_assign, int*[3]>(true)) );
VERIFY( (test_category<has_trivial_assign, int(*[][2])(int)>(true)) );
VERIFY( (test_category<has_trivial_assign, int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<has_trivial_assign,
int (ClassType::*[][2][3]) (int)>(true)) );
}

View File

@ -1,6 +1,6 @@
// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005 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
@ -30,23 +30,21 @@ void test01()
using std::tr1::has_trivial_copy;
using namespace __gnu_test;
VERIFY( (test_copy_property<has_trivial_copy, void>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, int>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, float>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, EnumType>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, int*>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, int(*)(int)>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, int (ClassType::*)>(true)) );
VERIFY( (test_copy_property<has_trivial_copy,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, int[2]>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, float[][3]>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, EnumType[2][3][4]>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, int*[3]>(true)) );
VERIFY( (test_copy_property<has_trivial_copy, int(*[][2])(int)>(true)) );
VERIFY( (test_copy_property<has_trivial_copy,
int (ClassType::*[2][3])>(true)) );
VERIFY( (test_copy_property<has_trivial_copy,
VERIFY( (test_category<has_trivial_copy, void>(true)) );
VERIFY( (test_category<has_trivial_copy, int>(true)) );
VERIFY( (test_category<has_trivial_copy, float>(true)) );
VERIFY( (test_category<has_trivial_copy, EnumType>(true)) );
VERIFY( (test_category<has_trivial_copy, int*>(true)) );
VERIFY( (test_category<has_trivial_copy, int(*)(int)>(true)) );
VERIFY( (test_category<has_trivial_copy, int (ClassType::*)>(true)) );
VERIFY( (test_category<has_trivial_copy, int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<has_trivial_copy, int[2]>(true)) );
VERIFY( (test_category<has_trivial_copy, float[][3]>(true)) );
VERIFY( (test_category<has_trivial_copy, EnumType[2][3][4]>(true)) );
VERIFY( (test_category<has_trivial_copy, int*[3]>(true)) );
VERIFY( (test_category<has_trivial_copy, int(*[][2])(int)>(true)) );
VERIFY( (test_category<has_trivial_copy, int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<has_trivial_copy,
int (ClassType::*[][2][3]) (int)>(true)) );
}