testsuite_tr1.h (test_category, [...]): constexpr in c++11 mode.

2013-12-06  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/util/testsuite_tr1.h (test_category, test_property,
	test_relationship): constexpr in c++11 mode.
	* testsuite/20_util/add_lvalue_reference/value.cc: Use static_assert
	and change to dg-do compile testcase.
	* testsuite/20_util/add_rvalue_reference/value.cc: Likewise.
	* testsuite/20_util/aligned_storage/value.cc: Likewise.
	* testsuite/20_util/has_trivial_copy_assign/value.cc: Likewise.
	* testsuite/20_util/has_trivial_copy_constructor/value.cc: Likewise.
	* testsuite/20_util/has_trivial_default_constructor/value.cc: Likewise.
	* testsuite/20_util/is_compound/value.cc: Likewise.
	* testsuite/20_util/is_constructible/value.cc: Likewise.
	* testsuite/20_util/is_convertible/value.cc: Likewise.
	* testsuite/20_util/is_copy_assignable/value.cc: Likewise.
	* testsuite/20_util/is_copy_constructible/value.cc: Likewise.
	* testsuite/20_util/is_floating_point/value.cc: Likewise.
	* testsuite/20_util/is_function/value.cc: Likewise.
	* testsuite/20_util/is_fundamental/value.cc: Likewise.
	* testsuite/20_util/is_integral/value.cc: Likewise.
	* testsuite/20_util/is_literal_type/value.cc: Likewise.
	* testsuite/20_util/is_lvalue_reference/value.cc: Likewise.
	* testsuite/20_util/is_member_function_pointer/value.cc: Likewise.
	* testsuite/20_util/is_member_object_pointer/value.cc: Likewise.
	* testsuite/20_util/is_member_pointer/value.cc: Likewise.
	* testsuite/20_util/is_move_assignable/value.cc: Likewise.
	* testsuite/20_util/is_move_constructible/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_assignable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_constructible/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_copy_assignable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_copy_constructible/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_default_constructible/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_move_assignable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_move_constructible/value.cc: Likewise.
	* testsuite/20_util/is_null_pointer/value.cc: Likewise.
	* testsuite/20_util/is_object/value.cc: Likewise.
	* testsuite/20_util/is_pod/value.cc: Likewise.
	* testsuite/20_util/is_reference/value.cc: Likewise.
	* testsuite/20_util/is_rvalue_reference/value.cc: Likewise.
	* testsuite/20_util/is_scalar/value.cc: Likewise.
	* testsuite/20_util/is_signed/value.cc: Likewise.
	* testsuite/20_util/is_standard_layout/value.cc: Likewise.
	* testsuite/20_util/is_trivial/value.cc: Likewise.
	* testsuite/20_util/is_trivially_destructible/value.cc: Likewise.
	* testsuite/20_util/is_unsigned/value.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-2.cc: Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs-1.cc: Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc: Likewise.
	* testsuite/20_util/remove_reference/value.cc: Likewise.

From-SVN: r205766
This commit is contained in:
Paolo Carlini 2013-12-06 23:08:41 +00:00 committed by Paolo Carlini
parent 07d50f394d
commit 44916fe15f
46 changed files with 1205 additions and 1296 deletions

View File

@ -1,3 +1,53 @@
2013-12-06 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/util/testsuite_tr1.h (test_category, test_property,
test_relationship): constexpr in c++11 mode.
* testsuite/20_util/add_lvalue_reference/value.cc: Use static_assert
and change to dg-do compile testcase.
* testsuite/20_util/add_rvalue_reference/value.cc: Likewise.
* testsuite/20_util/aligned_storage/value.cc: Likewise.
* testsuite/20_util/has_trivial_copy_assign/value.cc: Likewise.
* testsuite/20_util/has_trivial_copy_constructor/value.cc: Likewise.
* testsuite/20_util/has_trivial_default_constructor/value.cc: Likewise.
* testsuite/20_util/is_compound/value.cc: Likewise.
* testsuite/20_util/is_constructible/value.cc: Likewise.
* testsuite/20_util/is_convertible/value.cc: Likewise.
* testsuite/20_util/is_copy_assignable/value.cc: Likewise.
* testsuite/20_util/is_copy_constructible/value.cc: Likewise.
* testsuite/20_util/is_floating_point/value.cc: Likewise.
* testsuite/20_util/is_function/value.cc: Likewise.
* testsuite/20_util/is_fundamental/value.cc: Likewise.
* testsuite/20_util/is_integral/value.cc: Likewise.
* testsuite/20_util/is_literal_type/value.cc: Likewise.
* testsuite/20_util/is_lvalue_reference/value.cc: Likewise.
* testsuite/20_util/is_member_function_pointer/value.cc: Likewise.
* testsuite/20_util/is_member_object_pointer/value.cc: Likewise.
* testsuite/20_util/is_member_pointer/value.cc: Likewise.
* testsuite/20_util/is_move_assignable/value.cc: Likewise.
* testsuite/20_util/is_move_constructible/value.cc: Likewise.
* testsuite/20_util/is_nothrow_assignable/value.cc: Likewise.
* testsuite/20_util/is_nothrow_constructible/value.cc: Likewise.
* testsuite/20_util/is_nothrow_copy_assignable/value.cc: Likewise.
* testsuite/20_util/is_nothrow_copy_constructible/value.cc: Likewise.
* testsuite/20_util/is_nothrow_default_constructible/value.cc: Likewise.
* testsuite/20_util/is_nothrow_move_assignable/value.cc: Likewise.
* testsuite/20_util/is_nothrow_move_constructible/value.cc: Likewise.
* testsuite/20_util/is_null_pointer/value.cc: Likewise.
* testsuite/20_util/is_object/value.cc: Likewise.
* testsuite/20_util/is_pod/value.cc: Likewise.
* testsuite/20_util/is_reference/value.cc: Likewise.
* testsuite/20_util/is_rvalue_reference/value.cc: Likewise.
* testsuite/20_util/is_scalar/value.cc: Likewise.
* testsuite/20_util/is_signed/value.cc: Likewise.
* testsuite/20_util/is_standard_layout/value.cc: Likewise.
* testsuite/20_util/is_trivial/value.cc: Likewise.
* testsuite/20_util/is_trivially_destructible/value.cc: Likewise.
* testsuite/20_util/is_unsigned/value.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs-2.cc: Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs-1.cc: Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc: Likewise.
* testsuite/20_util/remove_reference/value.cc: Likewise.
2013-12-03 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/std/fstream (basic_filebuf::open): Use preformatted text

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2007-06-02 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
@ -19,35 +21,37 @@
// <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::add_lvalue_reference;
using std::is_same;
using namespace __gnu_test;
VERIFY( (is_same<add_lvalue_reference<int>::type, int&>::value) );
VERIFY( (is_same<add_lvalue_reference<int&>::type, int&>::value) );
VERIFY( (is_same<add_lvalue_reference<const int>::type, const int&>::value) );
VERIFY( (is_same<add_lvalue_reference<int*>::type, int*&>::value) );
VERIFY( (is_same<add_lvalue_reference<ClassType&>::type, ClassType&>::value) );
VERIFY( (is_same<add_lvalue_reference<ClassType>::type, ClassType&>::value) );
VERIFY( (is_same<add_lvalue_reference<int(int)>::type, int(&)(int)>::value) );
VERIFY( (is_same<add_lvalue_reference<int&&>::type, int&>::value) );
VERIFY( (is_same<add_lvalue_reference<ClassType&&>::type, ClassType&>::value) );
VERIFY( (is_same<add_lvalue_reference<void>::type, void>::value) );
VERIFY( (is_same<add_lvalue_reference<const void>::type, const void>::value) );
VERIFY( (is_same<add_lvalue_reference<bool(int) const>::type, bool(int) const>::value) );
VERIFY( (is_same<add_lvalue_reference<bool(int) &>::type, bool(int) &>::value) );
VERIFY( (is_same<add_lvalue_reference<bool(int) const &&>::type, bool(int) const &&>::value) );
VERIFY( (is_same<add_lvalue_reference<bool(int)>::type, bool(&)(int)>::value) );
}
int main()
{
test01();
return 0;
static_assert(is_same<add_lvalue_reference<int>::type, int&>::value, "");
static_assert(is_same<add_lvalue_reference<int&>::type, int&>::value, "" );
static_assert(is_same<add_lvalue_reference<const int>::type,
const int&>::value, "");
static_assert(is_same<add_lvalue_reference<int*>::type, int*&>::value, "");
static_assert(is_same<add_lvalue_reference<ClassType&>::type,
ClassType&>::value, "");
static_assert(is_same<add_lvalue_reference<ClassType>::type,
ClassType&>::value, "");
static_assert(is_same<add_lvalue_reference<int(int)>::type,
int(&)(int)>::value, "");
static_assert(is_same<add_lvalue_reference<int&&>::type, int&>::value, "");
static_assert(is_same<add_lvalue_reference<ClassType&&>::type,
ClassType&>::value, "");
static_assert(is_same<add_lvalue_reference<void>::type, void>::value, "");
static_assert(is_same<add_lvalue_reference<const void>::type,
const void>::value, "");
static_assert(is_same<add_lvalue_reference<bool(int) const>::type,
bool(int) const>::value, "");
static_assert(is_same<add_lvalue_reference<bool(int) &>::type,
bool(int) &>::value, "");
static_assert(is_same<add_lvalue_reference<bool(int) const &&>::type,
bool(int) const &&>::value, "");
static_assert(is_same<add_lvalue_reference<bool(int)>::type,
bool(&)(int)>::value, "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2007-06-02 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
@ -19,34 +21,35 @@
// <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::add_rvalue_reference;
using std::is_same;
using namespace __gnu_test;
VERIFY( (is_same<add_rvalue_reference<int>::type, int&&>::value) );
VERIFY( (is_same<add_rvalue_reference<int&&>::type, int&&>::value) );
VERIFY( (is_same<add_rvalue_reference<int&>::type, int&>::value) );
VERIFY( (is_same<add_rvalue_reference<const int>::type, const int&&>::value) );
VERIFY( (is_same<add_rvalue_reference<int*>::type, int*&&>::value) );
VERIFY( (is_same<add_rvalue_reference<ClassType&&>::type, ClassType&&>::value) );
VERIFY( (is_same<add_rvalue_reference<ClassType>::type, ClassType&&>::value) );
VERIFY( (is_same<add_rvalue_reference<int(int)>::type, int(&&)(int)>::value) );
VERIFY( (is_same<add_rvalue_reference<void>::type, void>::value) );
VERIFY( (is_same<add_rvalue_reference<const void>::type, const void>::value) );
VERIFY( (is_same<add_rvalue_reference<bool(int) const>::type, bool(int) const>::value) );
VERIFY( (is_same<add_rvalue_reference<bool(int) &>::type, bool(int) &>::value) );
VERIFY( (is_same<add_rvalue_reference<bool(int) const &&>::type, bool(int) const &&>::value) );
VERIFY( (is_same<add_rvalue_reference<bool(int)>::type, bool(&&)(int)>::value) );
}
int main()
{
test01();
return 0;
static_assert(is_same<add_rvalue_reference<int>::type, int&&>::value, "");
static_assert(is_same<add_rvalue_reference<int&&>::type, int&&>::value, "");
static_assert(is_same<add_rvalue_reference<int&>::type, int&>::value, "");
static_assert(is_same<add_rvalue_reference<const int>::type,
const int&&>::value, "");
static_assert(is_same<add_rvalue_reference<int*>::type, int*&&>::value, "");
static_assert(is_same<add_rvalue_reference<ClassType&&>::type,
ClassType&&>::value, "");
static_assert(is_same<add_rvalue_reference<ClassType>::type,
ClassType&&>::value, "");
static_assert(is_same<add_rvalue_reference<int(int)>::type,
int(&&)(int)>::value, "");
static_assert(is_same<add_rvalue_reference<void>::type, void>::value, "");
static_assert(is_same<add_rvalue_reference<const void>::type,
const void>::value, "");
static_assert(is_same<add_rvalue_reference<bool(int) const>::type,
bool(int) const>::value, "");
static_assert(is_same<add_rvalue_reference<bool(int) &>::type,
bool(int) &>::value, "");
static_assert(is_same<add_rvalue_reference<bool(int) const &&>::type,
bool(int) const &&>::value, "");
static_assert(is_same<add_rvalue_reference<bool(int)>::type,
bool(&&)(int)>::value, "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2007-09-17 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
@ -19,49 +20,43 @@
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
struct MSAlignType { } __attribute__((__aligned__));
void test01()
{
bool test __attribute__((unused)) = true;
using std::aligned_storage;
using std::alignment_of;
using namespace __gnu_test;
const std::size_t align_c = alignment_of<char>::value;
VERIFY( (sizeof(aligned_storage<4, align_c>::type) >= 4) );
VERIFY( (__alignof__(aligned_storage<4, align_c>::type) == align_c) );
static_assert(sizeof(aligned_storage<4, align_c>::type) >= 4, "");
static_assert(__alignof__(aligned_storage<4, align_c>::type) == align_c, "");
const std::size_t align_s = alignment_of<short>::value;
VERIFY( (sizeof(aligned_storage<1, align_s>::type) >= 1) );
VERIFY( (__alignof__(aligned_storage<1, align_s>::type) == align_s) );
static_assert(sizeof(aligned_storage<1, align_s>::type) >= 1, "");
static_assert(__alignof__(aligned_storage<1, align_s>::type) == align_s, "");
const std::size_t align_i = alignment_of<int>::value;
VERIFY( (sizeof(aligned_storage<7, align_i>::type) >= 7) );
VERIFY( (__alignof__(aligned_storage<7, align_i>::type) == align_i) );
static_assert(sizeof(aligned_storage<7, align_i>::type) >= 7, "");
static_assert(__alignof__(aligned_storage<7, align_i>::type) == align_i, "");
const std::size_t align_d = alignment_of<double>::value;
VERIFY( (sizeof(aligned_storage<2, align_d>::type) >= 2) );
VERIFY( (__alignof__(aligned_storage<2, align_d>::type) == align_d) );
static_assert(sizeof(aligned_storage<2, align_d>::type) >= 2, "");
static_assert(__alignof__(aligned_storage<2, align_d>::type) == align_d, "");
const std::size_t align_ai = alignment_of<int[4]>::value;
VERIFY( (sizeof(aligned_storage<20, align_ai>::type) >= 20) );
VERIFY( (__alignof__(aligned_storage<20, align_ai>::type) == align_ai) );
static_assert(sizeof(aligned_storage<20, align_ai>::type) >= 20, "");
static_assert(__alignof__(aligned_storage<20, align_ai>::type) == align_ai,
"");
const std::size_t align_ct = alignment_of<ClassType>::value;
VERIFY( (sizeof(aligned_storage<11, align_ct>::type) >= 11) );
VERIFY( (__alignof__(aligned_storage<11, align_ct>::type) == align_ct) );
static_assert(sizeof(aligned_storage<11, align_ct>::type) >= 11, "");
static_assert(__alignof__(aligned_storage<11, align_ct>::type) == align_ct,
"");
const std::size_t align_msa = alignment_of<MSAlignType>::value;
VERIFY( (sizeof(aligned_storage<5>::type) >= 5) );
VERIFY( (__alignof__(aligned_storage<5>::type) == align_msa) );
}
int main()
{
test01();
return 0;
static_assert(sizeof(aligned_storage<5>::type) >= 5, "");
static_assert(__alignof__(aligned_storage<5>::type) == align_msa, "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
@ -19,39 +21,34 @@
// <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::has_trivial_copy_assign;
using namespace __gnu_test;
VERIFY( (test_property<has_trivial_copy_assign, int>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, float>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, EnumType>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, int*>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, int(*)(int)>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, int (ClassType::*)>(true)) );
VERIFY( (test_property<has_trivial_copy_assign,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, int[2]>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, float[][3]>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, EnumType[2][3][4]>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, int*[3]>(true)) );
VERIFY( (test_property<has_trivial_copy_assign, int(*[][2])(int)>(true)) );
VERIFY( (test_property<has_trivial_copy_assign,
int (ClassType::*[2][3])>(true)) );
VERIFY( (test_property<has_trivial_copy_assign,
int (ClassType::*[][2][3]) (int)>(true)) );
static_assert(test_property<has_trivial_copy_assign, int>(true), "");
static_assert(test_property<has_trivial_copy_assign, float>(true), "");
static_assert(test_property<has_trivial_copy_assign, EnumType>(true), "");
static_assert(test_property<has_trivial_copy_assign, int*>(true), "");
static_assert(test_property<has_trivial_copy_assign, int(*)(int)>(true), "");
static_assert(test_property<has_trivial_copy_assign,
int (ClassType::*)>(true), "");
static_assert(test_property<has_trivial_copy_assign,
int (ClassType::*) (int)>(true), "");
static_assert(test_property<has_trivial_copy_assign, int[2]>(true), "");
static_assert(test_property<has_trivial_copy_assign, float[][3]>(true), "");
static_assert(test_property<has_trivial_copy_assign,
EnumType[2][3][4]>(true), "");
static_assert(test_property<has_trivial_copy_assign, int*[3]>(true), "");
static_assert(test_property<has_trivial_copy_assign,
int(*[][2])(int)>(true), "");
static_assert(test_property<has_trivial_copy_assign,
int (ClassType::*[2][3])>(true), "");
static_assert(test_property<has_trivial_copy_assign,
int (ClassType::*[][2][3]) (int)>(true), "");
// Negative tests.
VERIFY( (test_property<has_trivial_copy_assign, void>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<has_trivial_copy_assign, void>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
@ -21,38 +23,38 @@
// 4.5.3 Type properties
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::has_trivial_copy_constructor;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<has_trivial_copy_constructor, int>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, float>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, EnumType>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int*>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int(*)(int)>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int (ClassType::*)>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int[2]>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, float[][3]>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, EnumType[2][3][4]>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int*[3]>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int(*[][2])(int)>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor, int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<has_trivial_copy_constructor,
int (ClassType::*[][2][3]) (int)>(true)) );
static_assert(test_category<has_trivial_copy_constructor, int>(true), "");
static_assert(test_category<has_trivial_copy_constructor, float>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
EnumType>(true), "");
static_assert(test_category<has_trivial_copy_constructor, int*>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
int(*)(int)>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
int (ClassType::*)>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
int (ClassType::*) (int)>(true), "");
static_assert(test_category<has_trivial_copy_constructor, int[2]>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
float[][3]>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
EnumType[2][3][4]>(true), "");
static_assert(test_category<has_trivial_copy_constructor, int*[3]>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
int(*[][2])(int)>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
int (ClassType::*[2][3])>(true), "");
static_assert(test_category<has_trivial_copy_constructor,
int (ClassType::*[][2][3]) (int)>(true), "");
// Negative tests.
VERIFY( (test_category<has_trivial_copy_constructor, void>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<has_trivial_copy_constructor, void>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2004-12-26 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
@ -21,41 +23,44 @@
// 4.5.3 Type properties
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::has_trivial_default_constructor;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<has_trivial_default_constructor, int>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, float>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, EnumType>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, int*>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, int(*)(int)>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, int (ClassType::*)>(true)) );
VERIFY( (test_category<has_trivial_default_constructor,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, int[2]>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, float[][3]>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, EnumType[2][3][4]>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, int*[3]>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, int(*[][2])(int)>(true)) );
VERIFY( (test_category<has_trivial_default_constructor,
int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<has_trivial_default_constructor,
int (ClassType::*[][2][3]) (int)>(true)) );
VERIFY( (test_category<has_trivial_default_constructor, ClassType>(true)) );
static_assert(test_category<has_trivial_default_constructor, int>(true), "");
static_assert(test_category<has_trivial_default_constructor,
float>(true), "");
static_assert(test_category<has_trivial_default_constructor,
EnumType>(true), "");
static_assert(test_category<has_trivial_default_constructor, int*>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int(*)(int)>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int (ClassType::*)>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int (ClassType::*) (int)>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int[2]>(true), "");
static_assert(test_category<has_trivial_default_constructor,
float[][3]>(true), "");
static_assert(test_category<has_trivial_default_constructor,
EnumType[2][3][4]>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int*[3]>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int(*[][2])(int)>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int (ClassType::*[2][3])>(true), "");
static_assert(test_category<has_trivial_default_constructor,
int (ClassType::*[][2][3]) (int)>(true), "");
static_assert(test_category<has_trivial_default_constructor,
ClassType>(true), "");
// Negative tests.
VERIFY( (test_category<has_trivial_default_constructor, void>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<has_trivial_default_constructor,
void>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,43 +19,35 @@
// <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_compound;
using namespace __gnu_test;
VERIFY( (test_category<is_compound, void>(false)) );
VERIFY( (test_category<is_compound, char>(false)) );
VERIFY( (test_category<is_compound, signed char>(false)) );
VERIFY( (test_category<is_compound, unsigned char>(false)) );
static_assert(test_category<is_compound, void>(false), "");
static_assert(test_category<is_compound, char>(false), "");
static_assert(test_category<is_compound, signed char>(false), "");
static_assert(test_category<is_compound, unsigned char>(false), "");
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_compound, wchar_t>(false)) );
static_assert(test_category<is_compound, wchar_t>(false), "");
#endif
VERIFY( (test_category<is_compound, short>(false)) );
VERIFY( (test_category<is_compound, unsigned short>(false)) );
VERIFY( (test_category<is_compound, int>(false)) );
VERIFY( (test_category<is_compound, unsigned int>(false)) );
VERIFY( (test_category<is_compound, long>(false)) );
VERIFY( (test_category<is_compound, unsigned long>(false)) );
VERIFY( (test_category<is_compound, long long>(false)) );
VERIFY( (test_category<is_compound, unsigned long long>(false)) );
VERIFY( (test_category<is_compound, float>(false)) );
VERIFY( (test_category<is_compound, double>(false)) );
VERIFY( (test_category<is_compound, long double>(false)) );
static_assert(test_category<is_compound, short>(false), "");
static_assert(test_category<is_compound, unsigned short>(false), "");
static_assert(test_category<is_compound, int>(false), "");
static_assert(test_category<is_compound, unsigned int>(false), "");
static_assert(test_category<is_compound, long>(false), "");
static_assert(test_category<is_compound, unsigned long>(false), "");
static_assert(test_category<is_compound, long long>(false), "");
static_assert(test_category<is_compound, unsigned long long>(false), "");
static_assert(test_category<is_compound, float>(false), "");
static_assert(test_category<is_compound, double>(false), "");
static_assert(test_category<is_compound, long double>(false), "");
// libstdc++/56609
VERIFY( (test_category<is_compound, std::nullptr_t>(false)) );
static_assert(test_category<is_compound, std::nullptr_t>(false), "");
// Sanity check.
VERIFY( (test_category<is_compound, ClassType>(true)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_compound, ClassType>(true), "");
}

View File

@ -1,5 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2009-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -18,28 +18,22 @@
// <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_constructible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_property<is_constructible, ExplicitClass, double&>(true)) );
VERIFY( (test_property<is_constructible, ExplicitClass, int&>(true)) );
static_assert(test_property<is_constructible,
ExplicitClass, double&>(true), "");
static_assert(test_property<is_constructible, ExplicitClass, int&>(true), "");
// Negative tests.
VERIFY( (test_property<is_constructible, ExplicitClass, void*>(false)) );
VERIFY( (test_property<is_constructible, ExplicitClass>(false)) );
VERIFY( (test_property<is_constructible, ExplicitClass,
int, double>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_constructible,
ExplicitClass, void*>(false), "");
static_assert(test_property<is_constructible, ExplicitClass>(false), "");
static_assert(test_property<is_constructible, ExplicitClass,
int, double>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2009-10-29 Paolo Carlini <paolo.carlini@oracle.com>
//
@ -20,87 +21,98 @@
// <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_convertible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_relationship<is_convertible, int, int>(true)) );
VERIFY( (test_relationship<is_convertible, int, const int>(true)) );
VERIFY( (test_relationship<is_convertible, volatile int, const int>(true)) );
VERIFY( (test_relationship<is_convertible, int, float>(true)) );
VERIFY( (test_relationship<is_convertible, double, float>(true)) );
VERIFY( (test_relationship<is_convertible, float, int>(true)) );
VERIFY( (test_relationship<is_convertible, int*, const int*>(true)) );
VERIFY( (test_relationship<is_convertible, int*, void*>(true)) );
VERIFY( (test_relationship<is_convertible, int[4], int*>(true)) );
VERIFY( (test_relationship<is_convertible, float&, int>(true)) );
VERIFY( (test_relationship<is_convertible, int, const int&>(true)) );
VERIFY( (test_relationship<is_convertible, const int&, int>(true)) );
VERIFY( (test_relationship<is_convertible, float, const int&>(true)) );
VERIFY( (test_relationship<is_convertible, int(int), int(*)(int)>(true)) );
VERIFY( (test_relationship<is_convertible, int(&)(int), int(*)(int)>(true)) );
VERIFY( (test_relationship<is_convertible, EnumType, int>(true)) );
VERIFY( (test_relationship<is_convertible, ClassType, ClassType>(true)) );
VERIFY( (test_relationship<is_convertible, DerivedType, ClassType>(true)) );
VERIFY( (test_relationship<is_convertible, DerivedType*, ClassType*>(true)) );
VERIFY( (test_relationship<is_convertible, DerivedType&, ClassType&>(true)) );
static_assert(test_relationship<is_convertible, int, int>(true), "");
static_assert(test_relationship<is_convertible, int, const int>(true), "");
static_assert(test_relationship<is_convertible,
volatile int, const int>(true), "");
static_assert(test_relationship<is_convertible, int, float>(true), "");
static_assert(test_relationship<is_convertible, double, float>(true), "");
static_assert(test_relationship<is_convertible, float, int>(true), "");
static_assert(test_relationship<is_convertible, int*, const int*>(true), "");
static_assert(test_relationship<is_convertible, int*, void*>(true), "");
static_assert(test_relationship<is_convertible, int[4], int*>(true), "");
static_assert(test_relationship<is_convertible, float&, int>(true), "");
static_assert(test_relationship<is_convertible, int, const int&>(true), "");
static_assert(test_relationship<is_convertible, const int&, int>(true), "");
static_assert(test_relationship<is_convertible, float, const int&>(true), "");
static_assert(test_relationship<is_convertible, int(int),
int(*)(int)>(true), "");
static_assert(test_relationship<is_convertible,
int(&)(int), int(*)(int)>(true), "");
static_assert(test_relationship<is_convertible, EnumType, int>(true), "");
static_assert(test_relationship<is_convertible, ClassType,
ClassType>(true), "");
static_assert(test_relationship<is_convertible, DerivedType,
ClassType>(true), "");
static_assert(test_relationship<is_convertible, DerivedType*,
ClassType*>(true), "");
static_assert(test_relationship<is_convertible, DerivedType&,
ClassType&>(true), "");
VERIFY( (test_relationship<is_convertible, const int, const int&>(true)) );
static_assert(test_relationship<is_convertible, const int,
const int&>(true), "");
VERIFY( (test_relationship<is_convertible, void, void>(true)) );
VERIFY( (test_relationship<is_convertible, const void, void>(true)) );
VERIFY( (test_relationship<is_convertible, void, volatile void>(true)) );
VERIFY( (test_relationship<is_convertible, double&, ExplicitClass>(true)) );
static_assert(test_relationship<is_convertible, void, void>(true), "");
static_assert(test_relationship<is_convertible, const void, void>(true), "");
static_assert(test_relationship<is_convertible, void,
volatile void>(true), "");
static_assert(test_relationship<is_convertible, double&,
ExplicitClass>(true), "");
VERIFY( (test_relationship<is_convertible, int(int), int(&)(int)>(true)) );
static_assert(test_relationship<is_convertible, int(int),
int(&)(int)>(true), "");
// Negative tests.
VERIFY( (test_relationship<is_convertible, const int*, int*>(false)) );
VERIFY( (test_relationship<is_convertible, int*, float*>(false)) );
VERIFY( (test_relationship<is_convertible, const int[4], int*>(false)) );
VERIFY( (test_relationship<is_convertible, int[4], int[4]>(false)) );
VERIFY( (test_relationship<is_convertible, const int&, int&>(false)) );
VERIFY( (test_relationship<is_convertible, float&, int&>(false)) );
VERIFY( (test_relationship<is_convertible, float, volatile int&>(false)) );
VERIFY( (test_relationship<is_convertible, int(int), int(int)>(false)) );
VERIFY( (test_relationship<is_convertible, int(int), int(*)(void)>(false)) );
VERIFY( (test_relationship<is_convertible, int(*)(int),
int(&)(int)>(false)) );
VERIFY( (test_relationship<is_convertible, int, EnumType>(false)) );
VERIFY( (test_relationship<is_convertible, int, ClassType>(false)) );
VERIFY( (test_relationship<is_convertible, ClassType, DerivedType>(false)) );
VERIFY( (test_relationship<is_convertible, ClassType*,
DerivedType*>(false)) );
VERIFY( (test_relationship<is_convertible, ClassType&,
DerivedType&>(false)) );
static_assert(test_relationship<is_convertible, const int*, int*>(false), "");
static_assert(test_relationship<is_convertible, int*, float*>(false), "");
static_assert(test_relationship<is_convertible, const int[4],
int*>(false), "");
static_assert(test_relationship<is_convertible, int[4], int[4]>(false), "");
static_assert(test_relationship<is_convertible, const int&, int&>(false), "");
static_assert(test_relationship<is_convertible, float&, int&>(false), "");
static_assert(test_relationship<is_convertible, float,
volatile int&>(false), "");
static_assert(test_relationship<is_convertible, int(int),
int(int)>(false), "");
static_assert(test_relationship<is_convertible, int(int),
int(*)(void)>(false), "");
static_assert(test_relationship<is_convertible, int(*)(int),
int(&)(int)>(false), "");
static_assert(test_relationship<is_convertible, int, EnumType>(false), "");
static_assert(test_relationship<is_convertible, int, ClassType>(false), "");
static_assert(test_relationship<is_convertible, ClassType,
DerivedType>(false), "");
static_assert(test_relationship<is_convertible, ClassType*,
DerivedType*>(false), "");
static_assert(test_relationship<is_convertible, ClassType&,
DerivedType&>(false), "");
VERIFY( (test_relationship<is_convertible, void, int>(false)) );
VERIFY( (test_relationship<is_convertible, void, float>(false)) );
VERIFY( (test_relationship<is_convertible, void, int(*)(int)>(false)) );
static_assert(test_relationship<is_convertible, void, int>(false), "");
static_assert(test_relationship<is_convertible, void, float>(false), "");
static_assert(test_relationship<is_convertible, void,
int(*)(int)>(false), "");
// C++0x
VERIFY( (test_relationship<is_convertible, int, void>(false)) );
VERIFY( (test_relationship<is_convertible, int[4], void>(false)) );
static_assert(test_relationship<is_convertible, int, void>(false), "");
static_assert(test_relationship<is_convertible, int[4], void>(false), "");
VERIFY( (test_relationship<is_convertible, int, int&>(false)) );
VERIFY( (test_relationship<is_convertible, float,
volatile float&>(false)) );
VERIFY( (test_relationship<is_convertible, const volatile int,
const volatile int&>(false)) );
VERIFY( (test_relationship<is_convertible, volatile int,
volatile int&>(false)) );
VERIFY( (test_relationship<is_convertible, int&, ExplicitClass>(false)) );
VERIFY( (test_relationship<is_convertible, void*, ExplicitClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_relationship<is_convertible, int, int&>(false), "");
static_assert(test_relationship<is_convertible, float,
volatile float&>(false), "");
static_assert(test_relationship<is_convertible, const volatile int,
const volatile int&>(false), "");
static_assert(test_relationship<is_convertible, volatile int,
volatile int&>(false), "");
static_assert(test_relationship<is_convertible, int&,
ExplicitClass>(false), "");
static_assert(test_relationship<is_convertible, void*,
ExplicitClass>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2011-05-19 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
@ -19,56 +21,57 @@
// <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_copy_assignable;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_property<is_copy_assignable, int>(true)) );
VERIFY( (test_property<is_copy_assignable, float>(true)) );
VERIFY( (test_property<is_copy_assignable, EnumType>(true)) );
VERIFY( (test_property<is_copy_assignable, int*>(true)) );
VERIFY( (test_property<is_copy_assignable, int(*)(int)>(true)) );
VERIFY( (test_property<is_copy_assignable, int (ClassType::*)>(true)) );
VERIFY( (test_property<is_copy_assignable,
int (ClassType::*) (int)>(true)) );
static_assert(test_property<is_copy_assignable, int>(true), "");
static_assert(test_property<is_copy_assignable, float>(true), "");
static_assert(test_property<is_copy_assignable, EnumType>(true), "");
static_assert(test_property<is_copy_assignable, int*>(true), "");
static_assert(test_property<is_copy_assignable, int(*)(int)>(true), "");
static_assert(test_property<is_copy_assignable,
int (ClassType::*)>(true), "");
static_assert(test_property<is_copy_assignable,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_copy_assignable, NoexceptCopyAssignClass>(true)) );
VERIFY( (test_property<is_copy_assignable, ExceptCopyAssignClass>(true)) );
static_assert(test_property<is_copy_assignable,
NoexceptCopyAssignClass>(true), "");
static_assert(test_property<is_copy_assignable,
ExceptCopyAssignClass>(true), "");
// Negative tests.
VERIFY( (test_property<is_copy_assignable, void>(false)) );
VERIFY( (test_property<is_copy_assignable, int[2]>(false)) );
VERIFY( (test_property<is_copy_assignable, float[][3]>(false)) );
VERIFY( (test_property<is_copy_assignable, EnumType[2][3][4]>(false)) );
VERIFY( (test_property<is_copy_assignable, int*[3]>(false)) );
VERIFY( (test_property<is_copy_assignable, int(*[][2])(int)>(false)) );
VERIFY( (test_property<is_copy_assignable,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_property<is_copy_assignable,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_property<is_copy_assignable,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_property<is_copy_assignable,
bool(ClassType) const>(false)) );
VERIFY( (test_property<is_copy_assignable,
bool(...) &&>(false)) );
VERIFY( (test_property<is_copy_assignable,
EnumType(int, ...)>(false)) );
static_assert(test_property<is_copy_assignable, void>(false), "");
static_assert(test_property<is_copy_assignable, int[2]>(false), "");
static_assert(test_property<is_copy_assignable, float[][3]>(false), "");
static_assert(test_property<is_copy_assignable,
EnumType[2][3][4]>(false), "");
static_assert(test_property<is_copy_assignable, int*[3]>(false), "");
static_assert(test_property<is_copy_assignable,
int(*[][2])(int)>(false), "");
static_assert(test_property<is_copy_assignable,
int (ClassType::*[2][3])>(false), "");
static_assert(test_property<is_copy_assignable,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_property<is_copy_assignable,
ClassType(unsigned) const &>(false), "");
static_assert(test_property<is_copy_assignable,
bool(ClassType) const>(false), "");
static_assert(test_property<is_copy_assignable,
bool(...) &&>(false), "");
static_assert(test_property<is_copy_assignable,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_copy_assignable, NoexceptMoveAssignClass>(false)) );
VERIFY( (test_property<is_copy_assignable, ExceptMoveAssignClass>(false)) );
VERIFY( (test_property<is_copy_assignable, DeletedCopyAssignClass>(false)) );
VERIFY( (test_property<is_copy_assignable, DeletedMoveAssignClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_copy_assignable,
NoexceptMoveAssignClass>(false), "");
static_assert(test_property<is_copy_assignable,
ExceptMoveAssignClass>(false), "");
static_assert(test_property<is_copy_assignable,
DeletedCopyAssignClass>(false), "");
static_assert(test_property<is_copy_assignable,
DeletedMoveAssignClass>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,64 +19,56 @@
// <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_copy_constructible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_copy_constructible, int>(true)) );
VERIFY( (test_category<is_copy_constructible, float>(true)) );
VERIFY( (test_category<is_copy_constructible, EnumType>(true)) );
VERIFY( (test_category<is_copy_constructible, int*>(true)) );
VERIFY( (test_category<is_copy_constructible, int(*)(int)>(true)) );
VERIFY( (test_category<is_copy_constructible,
int (ClassType::*)>(true)) );
VERIFY( (test_category<is_copy_constructible,
int (ClassType::*) (int)>(true)) );
static_assert(test_category<is_copy_constructible, int>(true), "");
static_assert(test_category<is_copy_constructible, float>(true), "");
static_assert(test_category<is_copy_constructible, EnumType>(true), "");
static_assert(test_category<is_copy_constructible, int*>(true), "");
static_assert(test_category<is_copy_constructible, int(*)(int)>(true), "");
static_assert(test_category<is_copy_constructible,
int (ClassType::*)>(true), "");
static_assert(test_category<is_copy_constructible,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_copy_constructible,
NoexceptCopyConsClass>(true)) );
VERIFY( (test_property<is_copy_constructible,
const NoexceptCopyConsClass>(true)) );
VERIFY( (test_property<is_copy_constructible,
ThrowCopyConsClass>(true)) );
VERIFY( (test_property<is_copy_constructible,
ExceptCopyConsClass>(true)) );
static_assert(test_property<is_copy_constructible,
NoexceptCopyConsClass>(true), "");
static_assert(test_property<is_copy_constructible,
const NoexceptCopyConsClass>(true), "");
static_assert(test_property<is_copy_constructible,
ThrowCopyConsClass>(true), "");
static_assert(test_property<is_copy_constructible,
ExceptCopyConsClass>(true), "");
// Negative tests.
VERIFY( (test_category<is_copy_constructible, void>(false)) );
VERIFY( (test_category<is_copy_constructible, int[2]>(false)) );
VERIFY( (test_category<is_copy_constructible, int[]>(false)) );
VERIFY( (test_category<is_copy_constructible, float[][3]>(false)) );
VERIFY( (test_category<is_copy_constructible,
EnumType[2][3][4]>(false)) );
VERIFY( (test_category<is_copy_constructible, int*[3]>(false)) );
VERIFY( (test_category<is_copy_constructible,
int(*[][2])(int)>(false)) );
VERIFY( (test_category<is_copy_constructible,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_category<is_copy_constructible,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_category<is_copy_constructible,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_category<is_copy_constructible,
bool(ClassType) const>(false)) );
VERIFY( (test_category<is_copy_constructible,
bool(...) &&>(false)) );
VERIFY( (test_category<is_copy_constructible,
EnumType(int, ...)>(false)) );
static_assert(test_category<is_copy_constructible, void>(false), "");
static_assert(test_category<is_copy_constructible, int[2]>(false), "");
static_assert(test_category<is_copy_constructible, int[]>(false), "");
static_assert(test_category<is_copy_constructible, float[][3]>(false), "");
static_assert(test_category<is_copy_constructible,
EnumType[2][3][4]>(false), "");
static_assert(test_category<is_copy_constructible, int*[3]>(false), "");
static_assert(test_category<is_copy_constructible,
int(*[][2])(int)>(false), "");
static_assert(test_category<is_copy_constructible,
int (ClassType::*[2][3])>(false), "");
static_assert(test_category<is_copy_constructible,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_category<is_copy_constructible,
ClassType(unsigned) const &>(false), "");
static_assert(test_category<is_copy_constructible,
bool(ClassType) const>(false), "");
static_assert(test_category<is_copy_constructible,
bool(...) &&>(false), "");
static_assert(test_category<is_copy_constructible,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_copy_constructible,
volatile NoexceptCopyConsClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_copy_constructible,
volatile NoexceptCopyConsClass>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,51 +19,45 @@
// <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_floating_point;
using namespace __gnu_test;
VERIFY( (test_category<is_floating_point, void>(false)) );
VERIFY( (test_category<is_floating_point, char>(false)) );
VERIFY( (test_category<is_floating_point, signed char>(false)) );
VERIFY( (test_category<is_floating_point, unsigned char>(false)) );
static_assert(test_category<is_floating_point, void>(false), "");
static_assert(test_category<is_floating_point, char>(false), "");
static_assert(test_category<is_floating_point, signed char>(false), "");
static_assert(test_category<is_floating_point, unsigned char>(false), "");
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_floating_point, wchar_t>(false)) );
static_assert(test_category<is_floating_point, wchar_t>(false), "");
#endif
VERIFY( (test_category<is_floating_point, short>(false)) );
VERIFY( (test_category<is_floating_point, unsigned short>(false)) );
VERIFY( (test_category<is_floating_point, int>(false)) );
VERIFY( (test_category<is_floating_point, unsigned int>(false)) );
VERIFY( (test_category<is_floating_point, long>(false)) );
VERIFY( (test_category<is_floating_point, unsigned long>(false)) );
VERIFY( (test_category<is_floating_point, long long>(false)) );
VERIFY( (test_category<is_floating_point, unsigned long long>(false)) );
static_assert(test_category<is_floating_point, short>(false), "");
static_assert(test_category<is_floating_point, unsigned short>(false), "");
static_assert(test_category<is_floating_point, int>(false), "");
static_assert(test_category<is_floating_point, unsigned int>(false), "");
static_assert(test_category<is_floating_point, long>(false), "");
static_assert(test_category<is_floating_point, unsigned long>(false), "");
static_assert(test_category<is_floating_point, long long>(false), "");
static_assert(test_category<is_floating_point,
unsigned long long>(false), "");
VERIFY( (test_category<is_floating_point, float>(true)) );
VERIFY( (test_category<is_floating_point, double>(true)) );
VERIFY( (test_category<is_floating_point, long double>(true)) );
static_assert(test_category<is_floating_point, float>(true), "");
static_assert(test_category<is_floating_point, double>(true), "");
static_assert(test_category<is_floating_point, long double>(true), "");
// GNU Extensions.
#ifdef _GLIBCXX_USE_FLOAT128
VERIFY( (test_category<is_floating_point, __float128>(true)) );
static_assert(test_category<is_floating_point, __float128>(true), "");
#endif
#ifdef _GLIBCXX_USE_INT128
VERIFY( (test_category<is_floating_point, __int128>(false)) );
VERIFY( (test_category<is_floating_point, unsigned __int128>(false)) );
static_assert(test_category<is_floating_point, __int128>(false), "");
static_assert(test_category<is_floating_point,
unsigned __int128>(false), "");
#endif
// Sanity check.
VERIFY( (test_category<is_floating_point, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_floating_point, ClassType>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,38 +19,32 @@
// <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_function;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_function, int (int)>(true)) );
VERIFY( (test_category<is_function, ClassType (ClassType)>(true)) );
VERIFY( (test_category<is_function, float (int, float, int[], int&)>(true)) );
VERIFY( (test_category<is_function, int (int, ...)>(true)) );
VERIFY( (test_category<is_function, bool (ClassType) const>(true)) );
VERIFY( (test_category<is_function, ClassType () &>(true)) );
VERIFY( (test_category<is_function, char (int, ClassType) const volatile &&>(true)) );
static_assert(test_category<is_function, int (int)>(true), "");
static_assert(test_category<is_function, ClassType (ClassType)>(true), "");
static_assert(test_category<is_function,
float (int, float, int[], int&)>(true), "");
static_assert(test_category<is_function, int (int, ...)>(true), "");
static_assert(test_category<is_function, bool (ClassType) const>(true), "");
static_assert(test_category<is_function, ClassType () &>(true), "");
static_assert(test_category<is_function,
char (int, ClassType) const volatile &&>(true), "");
// Negative tests.
VERIFY( (test_category<is_function, int&>(false)) );
VERIFY( (test_category<is_function, void>(false)) );
VERIFY( (test_category<is_function, const void>(false)) );
static_assert(test_category<is_function, int&>(false), "");
static_assert(test_category<is_function, void>(false), "");
static_assert(test_category<is_function, const void>(false), "");
VERIFY( (test_category<is_function, AbstractClass>(false)) );
VERIFY( (test_category<is_function, int(&)(int)>(false)) );
static_assert(test_category<is_function, AbstractClass>(false), "");
static_assert(test_category<is_function, int(&)(int)>(false), "");
// Sanity check.
VERIFY( (test_category<is_function, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_function, ClassType>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,43 +19,35 @@
// <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_fundamental;
using namespace __gnu_test;
VERIFY( (test_category<is_fundamental, void>(true)) );
VERIFY( (test_category<is_fundamental, char>(true)) );
VERIFY( (test_category<is_fundamental, signed char>(true)) );
VERIFY( (test_category<is_fundamental, unsigned char>(true)) );
static_assert(test_category<is_fundamental, void>(true), "");
static_assert(test_category<is_fundamental, char>(true), "");
static_assert(test_category<is_fundamental, signed char>(true), "");
static_assert(test_category<is_fundamental, unsigned char>(true), "");
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_fundamental, wchar_t>(true)) );
static_assert(test_category<is_fundamental, wchar_t>(true), "");
#endif
VERIFY( (test_category<is_fundamental, short>(true)) );
VERIFY( (test_category<is_fundamental, unsigned short>(true)) );
VERIFY( (test_category<is_fundamental, int>(true)) );
VERIFY( (test_category<is_fundamental, unsigned int>(true)) );
VERIFY( (test_category<is_fundamental, long>(true)) );
VERIFY( (test_category<is_fundamental, unsigned long>(true)) );
VERIFY( (test_category<is_fundamental, long long>(true)) );
VERIFY( (test_category<is_fundamental, unsigned long long>(true)) );
VERIFY( (test_category<is_fundamental, float>(true)) );
VERIFY( (test_category<is_fundamental, double>(true)) );
VERIFY( (test_category<is_fundamental, long double>(true)) );
static_assert(test_category<is_fundamental, short>(true), "");
static_assert(test_category<is_fundamental, unsigned short>(true), "");
static_assert(test_category<is_fundamental, int>(true), "");
static_assert(test_category<is_fundamental, unsigned int>(true), "");
static_assert(test_category<is_fundamental, long>(true), "");
static_assert(test_category<is_fundamental, unsigned long>(true), "");
static_assert(test_category<is_fundamental, long long>(true), "");
static_assert(test_category<is_fundamental, unsigned long long>(true), "");
static_assert(test_category<is_fundamental, float>(true), "");
static_assert(test_category<is_fundamental, double>(true), "");
static_assert(test_category<is_fundamental, long double>(true), "");
// libstdc++/56609
VERIFY( (test_category<is_fundamental, std::nullptr_t>(true)) );
static_assert(test_category<is_fundamental, std::nullptr_t>(true), "");
// Sanity check.
VERIFY( (test_category<is_fundamental, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_fundamental, ClassType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2008-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2008-2013 Free Software Foundation, Inc.
@ -19,54 +21,46 @@
// <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_integral;
using namespace __gnu_test;
VERIFY( (test_category<is_integral, void>(false)) );
VERIFY( (test_category<is_integral, char>(true)) );
VERIFY( (test_category<is_integral, signed char>(true)) );
VERIFY( (test_category<is_integral, unsigned char>(true)) );
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_integral, wchar_t>(true)) );
#endif
VERIFY( (test_category<is_integral, char16_t>(true)) );
VERIFY( (test_category<is_integral, char32_t>(true)) );
VERIFY( (test_category<is_integral, short>(true)) );
VERIFY( (test_category<is_integral, unsigned short>(true)) );
VERIFY( (test_category<is_integral, int>(true)) );
VERIFY( (test_category<is_integral, unsigned int>(true)) );
VERIFY( (test_category<is_integral, long>(true)) );
VERIFY( (test_category<is_integral, unsigned long>(true)) );
VERIFY( (test_category<is_integral, long long>(true)) );
VERIFY( (test_category<is_integral, unsigned long long>(true)) );
VERIFY( (test_category<is_integral, float>(false)) );
VERIFY( (test_category<is_integral, double>(false)) );
VERIFY( (test_category<is_integral, long double>(false)) );
static_assert(test_category<is_integral, void>(false), "");
static_assert(test_category<is_integral, char>(true), "");
static_assert(test_category<is_integral, signed char>(true), "");
static_assert(test_category<is_integral, unsigned char>(true), "");
#ifdef _GLIBCXX_USE_WCHAR_T
static_assert(test_category<is_integral, wchar_t>(true), "");
#endif
static_assert(test_category<is_integral, char16_t>(true), "");
static_assert(test_category<is_integral, char32_t>(true), "");
static_assert(test_category<is_integral, short>(true), "");
static_assert(test_category<is_integral, unsigned short>(true), "");
static_assert(test_category<is_integral, int>(true), "");
static_assert(test_category<is_integral, unsigned int>(true), "");
static_assert(test_category<is_integral, long>(true), "");
static_assert(test_category<is_integral, unsigned long>(true), "");
static_assert(test_category<is_integral, long long>(true), "");
static_assert(test_category<is_integral, unsigned long long>(true), "");
static_assert(test_category<is_integral, float>(false), "");
static_assert(test_category<is_integral, double>(false), "");
static_assert(test_category<is_integral, long double>(false), "");
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
VERIFY( (test_category<is_integral, __int128>(true)) );
VERIFY( (test_category<is_integral, unsigned __int128>(true)) );
static_assert(test_category<is_integral, __int128>(true), "");
static_assert(test_category<is_integral, unsigned __int128>(true), "");
#endif
#ifdef _GLIBCXX_USE_FLOAT128
VERIFY( (test_category<is_integral, __float128>(false)) );
static_assert(test_category<is_integral, __float128>(false), "");
#endif
// Sanity check.
VERIFY( (test_category<is_integral, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_integral, ClassType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-03-23 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
@ -19,36 +21,28 @@
// <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_literal_type;
using namespace __gnu_test;
VERIFY( (test_category<is_literal_type, int>(true)) );
VERIFY( (test_category<is_literal_type, unsigned char>(true)) );
static_assert(test_category<is_literal_type, int>(true), "");
static_assert(test_category<is_literal_type, unsigned char>(true), "");
VERIFY( (test_category<is_literal_type, TType>(true)) );
VERIFY( (test_category<is_literal_type, PODType>(true)) );
static_assert(test_category<is_literal_type, TType>(true), "");
static_assert(test_category<is_literal_type, PODType>(true), "");
VERIFY( (test_category<is_literal_type, NType>(false)) );
VERIFY( (test_category<is_literal_type, SLType>(false)) );
static_assert(test_category<is_literal_type, NType>(false), "");
static_assert(test_category<is_literal_type, SLType>(false), "");
VERIFY( (test_category<is_literal_type, LType>(true)) );
VERIFY( (test_category<is_literal_type, LType[5]>(true)) );
static_assert(test_category<is_literal_type, LType>(true), "");
static_assert(test_category<is_literal_type, LType[5]>(true), "");
VERIFY( (test_category<is_literal_type, NLType>(false)) );
VERIFY( (test_category<is_literal_type, NLType[5]>(false)) );
static_assert(test_category<is_literal_type, NLType>(false), "");
static_assert(test_category<is_literal_type, NLType[5]>(false), "");
VERIFY( (test_category<is_literal_type, LTypeDerived>(true)) );
VERIFY( (test_category<is_literal_type, LTypeDerived[5]>(true)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_literal_type, LTypeDerived>(true), "");
static_assert(test_category<is_literal_type, LTypeDerived[5]>(true), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2007-06-02 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
@ -19,26 +21,19 @@
// <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_lvalue_reference;
using namespace __gnu_test;
VERIFY( (test_category<is_lvalue_reference, int&>(true)) );
VERIFY( (test_category<is_lvalue_reference, ClassType&>(true)) );
VERIFY( (test_category<is_lvalue_reference, int(&)(int)>(true)) );
static_assert(test_category<is_lvalue_reference, int&>(true), "");
static_assert(test_category<is_lvalue_reference, ClassType&>(true), "");
static_assert(test_category<is_lvalue_reference, int(&)(int)>(true), "");
// Sanity check.
VERIFY( (test_category<is_lvalue_reference, int&&>(false)) );
VERIFY( (test_category<is_lvalue_reference, ClassType>(false)) );
static_assert(test_category<is_lvalue_reference, int&&>(false), "");
static_assert(test_category<is_lvalue_reference, ClassType>(false), "");
}
int main()
{
test01();
return 0;
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,41 +19,34 @@
// <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_member_function_pointer;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (int) const>(true)) );
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (float, ...)>(true)) );
VERIFY( (test_category<is_member_function_pointer,
ClassType (ClassType::*) (ClassType)>(true)) );
VERIFY( (test_category<is_member_function_pointer,
float (ClassType::*) (int, float, int[], int&)>(true)) );
static_assert(test_category<is_member_function_pointer,
int (ClassType::*) (int)>(true), "");
static_assert(test_category<is_member_function_pointer,
int (ClassType::*) (int) const>(true), "");
static_assert(test_category<is_member_function_pointer,
int (ClassType::*) (float, ...)>(true), "");
static_assert(test_category<is_member_function_pointer,
ClassType (ClassType::*) (ClassType)>(true), "");
static_assert(test_category<is_member_function_pointer,
float (ClassType::*) (int, float, int[], int&)>(true), "");
// Negative tests.
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*)>(false)) );
VERIFY( (test_category<is_member_function_pointer,
const int (ClassType::*)>(false)) );
VERIFY( (test_category<is_member_function_pointer,
ClassType (ClassType::*)>(false)) );
static_assert(test_category<is_member_function_pointer,
int (ClassType::*)>(false), "");
static_assert(test_category<is_member_function_pointer,
const int (ClassType::*)>(false), "");
static_assert(test_category<is_member_function_pointer,
ClassType (ClassType::*)>(false), "");
// Sanity check.
VERIFY( (test_category<is_member_function_pointer, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_member_function_pointer,
ClassType>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,37 +19,35 @@
// <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_member_object_pointer;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_object_pointer,
const int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_object_pointer,
ClassType (ClassType::*)>(true)) );
static_assert(test_category<is_member_object_pointer,
int (ClassType::*)>(true), "");
static_assert(test_category<is_member_object_pointer,
const int (ClassType::*)>(true), "");
static_assert(test_category<is_member_object_pointer,
ClassType (ClassType::*)>(true), "");
// Negative tests.
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*) (int)>(false)) );
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*) (int) const>(false)) );
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*) (float, ...)>(false)) );
VERIFY( (test_category<is_member_object_pointer,
ClassType (ClassType::*) (ClassType)>(false)) );
VERIFY( (test_category<is_member_object_pointer,
float (ClassType::*) (int, float, int[], int&)>(false)) );
static_assert(test_category<is_member_object_pointer,
int (ClassType::*) (int)>(false), "");
static_assert(test_category<is_member_object_pointer,
int (ClassType::*) (int) const>(false), "");
static_assert(test_category<is_member_object_pointer,
int (ClassType::*) (float, ...)>(false), "");
static_assert(test_category<is_member_object_pointer,
ClassType (ClassType::*) (ClassType)>(false), "");
static_assert(test_category<is_member_object_pointer,
float (ClassType::*) (int, float, int[], int&)>(false), "");
// Sanity check.
VERIFY( (test_category<is_member_object_pointer, ClassType>(false)) );
static_assert(test_category<is_member_object_pointer, ClassType>(false), "");
}
int main()

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,36 +19,30 @@
// <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_member_pointer;
using namespace __gnu_test;
VERIFY( (test_category<is_member_pointer, int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_pointer, const int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_pointer, ClassType (ClassType::*)>(true)) );
static_assert(test_category<is_member_pointer, int (ClassType::*)>(true), "");
static_assert(test_category<is_member_pointer,
const int (ClassType::*)>(true), "");
static_assert(test_category<is_member_pointer,
ClassType (ClassType::*)>(true), "");
VERIFY( (test_category<is_member_pointer,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<is_member_pointer,
int (ClassType::*) (int) const>(true)) );
VERIFY( (test_category<is_member_pointer,
int (ClassType::*) (float, ...)>(true)) );
VERIFY( (test_category<is_member_pointer,
ClassType (ClassType::*) (ClassType)>(true)) );
VERIFY( (test_category<is_member_pointer,
float (ClassType::*) (int, float, int[], int&)>(true)) );
static_assert(test_category<is_member_pointer,
int (ClassType::*) (int)>(true), "");
static_assert(test_category<is_member_pointer,
int (ClassType::*) (int) const>(true), "");
static_assert(test_category<is_member_pointer,
int (ClassType::*) (float, ...)>(true), "");
static_assert(test_category<is_member_pointer,
ClassType (ClassType::*) (ClassType)>(true), "");
static_assert(test_category<is_member_pointer,
float (ClassType::*) (int, float, int[], int&)>(true), "");
// Sanity check.
VERIFY( (test_category<is_member_pointer, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_member_pointer, ClassType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2011-05-19 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
@ -19,56 +21,56 @@
// <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_move_assignable;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_property<is_move_assignable, int>(true)) );
VERIFY( (test_property<is_move_assignable, float>(true)) );
VERIFY( (test_property<is_move_assignable, EnumType>(true)) );
VERIFY( (test_property<is_move_assignable, int*>(true)) );
VERIFY( (test_property<is_move_assignable, int(*)(int)>(true)) );
VERIFY( (test_property<is_move_assignable, int (ClassType::*)>(true)) );
VERIFY( (test_property<is_move_assignable,
int (ClassType::*) (int)>(true)) );
static_assert(test_property<is_move_assignable, int>(true), "");
static_assert(test_property<is_move_assignable, float>(true), "");
static_assert(test_property<is_move_assignable, EnumType>(true), "");
static_assert(test_property<is_move_assignable, int*>(true), "");
static_assert(test_property<is_move_assignable, int(*)(int)>(true), "");
static_assert(test_property<is_move_assignable,
int (ClassType::*)>(true), "");
static_assert(test_property<is_move_assignable,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_move_assignable, NoexceptMoveAssignClass>(true)) );
VERIFY( (test_property<is_move_assignable, ExceptMoveAssignClass>(true)) );
VERIFY( (test_property<is_move_assignable, NoexceptCopyAssignClass>(true)) );
VERIFY( (test_property<is_move_assignable, ExceptCopyAssignClass>(true)) );
static_assert(test_property<is_move_assignable,
NoexceptMoveAssignClass>(true), "");
static_assert(test_property<is_move_assignable,
ExceptMoveAssignClass>(true), "");
static_assert(test_property<is_move_assignable,
NoexceptCopyAssignClass>(true), "");
static_assert(test_property<is_move_assignable,
ExceptCopyAssignClass>(true), "");
// Negative tests.
VERIFY( (test_property<is_move_assignable, void>(false)) );
VERIFY( (test_property<is_move_assignable, int[2]>(false)) );
VERIFY( (test_property<is_move_assignable, float[][3]>(false)) );
VERIFY( (test_property<is_move_assignable, EnumType[2][3][4]>(false)) );
VERIFY( (test_property<is_move_assignable, int*[3]>(false)) );
VERIFY( (test_property<is_move_assignable, int(*[][2])(int)>(false)) );
VERIFY( (test_property<is_move_assignable,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_property<is_move_assignable,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_property<is_move_assignable,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_property<is_move_assignable,
bool(ClassType) const>(false)) );
VERIFY( (test_property<is_move_assignable,
bool(...) &&>(false)) );
VERIFY( (test_property<is_move_assignable,
EnumType(int, ...)>(false)) );
static_assert(test_property<is_move_assignable, void>(false), "");
static_assert(test_property<is_move_assignable, int[2]>(false), "");
static_assert(test_property<is_move_assignable, float[][3]>(false), "");
static_assert(test_property<is_move_assignable,
EnumType[2][3][4]>(false), "");
static_assert(test_property<is_move_assignable, int*[3]>(false), "");
static_assert(test_property<is_move_assignable, int(*[][2])(int)>(false), "");
static_assert(test_property<is_move_assignable,
int (ClassType::*[2][3])>(false), "");
static_assert(test_property<is_move_assignable,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_property<is_move_assignable,
ClassType(unsigned) const &>(false), "");
static_assert(test_property<is_move_assignable,
bool(ClassType) const>(false), "");
static_assert(test_property<is_move_assignable,
bool(...) &&>(false), "");
static_assert(test_property<is_move_assignable,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_move_assignable, DeletedCopyAssignClass>(false)) );
VERIFY( (test_property<is_move_assignable, DeletedMoveAssignClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_move_assignable,
DeletedCopyAssignClass>(false), "");
static_assert(test_property<is_move_assignable,
DeletedMoveAssignClass>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,64 +19,56 @@
// <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_move_constructible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_move_constructible, int>(true)) );
VERIFY( (test_category<is_move_constructible, float>(true)) );
VERIFY( (test_category<is_move_constructible, EnumType>(true)) );
VERIFY( (test_category<is_move_constructible, int*>(true)) );
VERIFY( (test_category<is_move_constructible, int(*)(int)>(true)) );
VERIFY( (test_category<is_move_constructible,
int (ClassType::*)>(true)) );
VERIFY( (test_category<is_move_constructible,
int (ClassType::*) (int)>(true)) );
static_assert(test_category<is_move_constructible, int>(true), "");
static_assert(test_category<is_move_constructible, float>(true), "");
static_assert(test_category<is_move_constructible, EnumType>(true), "");
static_assert(test_category<is_move_constructible, int*>(true), "");
static_assert(test_category<is_move_constructible, int(*)(int)>(true), "");
static_assert(test_category<is_move_constructible,
int (ClassType::*)>(true), "");
static_assert(test_category<is_move_constructible,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_move_constructible,
NoexceptMoveConsClass>(true)) );
VERIFY( (test_property<is_move_constructible,
ThrowMoveConsClass>(true)) );
VERIFY( (test_property<is_move_constructible,
ExceptMoveConsClass>(true)) );
static_assert(test_property<is_move_constructible,
NoexceptMoveConsClass>(true), "");
static_assert(test_property<is_move_constructible,
ThrowMoveConsClass>(true), "");
static_assert(test_property<is_move_constructible,
ExceptMoveConsClass>(true), "");
// Negative tests.
VERIFY( (test_category<is_move_constructible, void>(false)) );
VERIFY( (test_category<is_move_constructible, int[2]>(false)) );
VERIFY( (test_category<is_move_constructible, int[]>(false)) );
VERIFY( (test_category<is_move_constructible, float[][3]>(false)) );
VERIFY( (test_category<is_move_constructible,
EnumType[2][3][4]>(false)) );
VERIFY( (test_category<is_move_constructible, int*[3]>(false)) );
VERIFY( (test_category<is_move_constructible,
int(*[][2])(int)>(false)) );
VERIFY( (test_category<is_move_constructible,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_category<is_move_constructible,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_category<is_move_constructible,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_category<is_move_constructible,
bool(ClassType) const>(false)) );
VERIFY( (test_category<is_move_constructible,
bool(...) &&>(false)) );
VERIFY( (test_category<is_move_constructible,
EnumType(int, ...)>(false)) );
static_assert(test_category<is_move_constructible, void>(false), "");
static_assert(test_category<is_move_constructible, int[2]>(false), "");
static_assert(test_category<is_move_constructible, int[]>(false), "");
static_assert(test_category<is_move_constructible, float[][3]>(false), "");
static_assert(test_category<is_move_constructible,
EnumType[2][3][4]>(false), "");
static_assert(test_category<is_move_constructible, int*[3]>(false), "");
static_assert(test_category<is_move_constructible,
int(*[][2])(int)>(false), "");
static_assert(test_category<is_move_constructible,
int (ClassType::*[2][3])>(false), "");
static_assert(test_category<is_move_constructible,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_category<is_move_constructible,
ClassType(unsigned) const &>(false), "");
static_assert(test_category<is_move_constructible,
bool(ClassType) const>(false), "");
static_assert(test_category<is_move_constructible,
bool(...) &&>(false), "");
static_assert(test_category<is_move_constructible,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_move_constructible,
const NoexceptMoveConsClass>(false)) );
VERIFY( (test_property<is_move_constructible,
volatile NoexceptMoveConsClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_move_constructible,
const NoexceptMoveConsClass>(false), "");
static_assert(test_property<is_move_constructible,
volatile NoexceptMoveConsClass>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2011-05-19 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
@ -19,40 +21,37 @@
// <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_nothrow_assignable;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_relationship<is_nothrow_assignable, int&, int>(true)) );
VERIFY( (test_relationship<is_nothrow_assignable, int&, const int>(true)) );
static_assert(test_relationship<is_nothrow_assignable, int&, int>(true), "");
static_assert(test_relationship<is_nothrow_assignable, int&,
const int>(true), "");
VERIFY( (test_relationship<is_nothrow_assignable,
NoexceptCopyAssignClass&, const NoexceptCopyAssignClass&>(true)) );
VERIFY( (test_relationship<is_nothrow_assignable,
NoexceptMoveAssignClass&, NoexceptMoveAssignClass&&>(true)) );
VERIFY( (test_relationship<is_nothrow_assignable,
NoexceptCopyAssignClass&, NoexceptCopyAssignClass&&>(true)) );
static_assert(test_relationship<is_nothrow_assignable,
NoexceptCopyAssignClass&,
const NoexceptCopyAssignClass&>(true), "");
static_assert(test_relationship<is_nothrow_assignable,
NoexceptMoveAssignClass&, NoexceptMoveAssignClass&&>(true), "");
static_assert(test_relationship<is_nothrow_assignable,
NoexceptCopyAssignClass&, NoexceptCopyAssignClass&&>(true), "");
// Negative tests.
VERIFY( (test_relationship<is_nothrow_assignable, int, int>(false)) );
VERIFY( (test_relationship<is_nothrow_assignable, int, const int>(false)) );
static_assert(test_relationship<is_nothrow_assignable, int, int>(false), "");
static_assert(test_relationship<is_nothrow_assignable, int,
const int>(false), "");
VERIFY( (test_relationship<is_nothrow_assignable,
ExceptCopyAssignClass&, const ExceptCopyAssignClass&>(false)) );
VERIFY( (test_relationship<is_nothrow_assignable,
ExceptMoveAssignClass&, ExceptMoveAssignClass&&>(false)) );
VERIFY( (test_relationship<is_nothrow_assignable,
NoexceptMoveAssignClass&, const NoexceptMoveAssignClass&>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_relationship<is_nothrow_assignable,
ExceptCopyAssignClass&,
const ExceptCopyAssignClass&>(false), "");
static_assert(test_relationship<is_nothrow_assignable,
ExceptMoveAssignClass&, ExceptMoveAssignClass&&>(false), "");
static_assert(test_relationship<is_nothrow_assignable,
NoexceptMoveAssignClass&,
const NoexceptMoveAssignClass&>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-06-09 Paolo Carlini <paolo.carlini@oracle.com>
@ -20,63 +21,55 @@
// <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_nothrow_constructible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
double&>(true)) );
VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
int&>(true)) );
VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
double&, int&, double&>(true)) );
VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
double&>(true)) );
VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
int&>(true)) );
VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
double&, int&, double&>(true)) );
static_assert(test_property<is_nothrow_constructible, NoexceptExplicitClass,
double&>(true), "");
static_assert(test_property<is_nothrow_constructible, NoexceptExplicitClass,
int&>(true), "");
static_assert(test_property<is_nothrow_constructible, NoexceptExplicitClass,
double&, int&, double&>(true), "");
static_assert(test_property<is_nothrow_constructible, NothrowExplicitClass,
double&>(true), "");
static_assert(test_property<is_nothrow_constructible, NothrowExplicitClass,
int&>(true), "");
static_assert(test_property<is_nothrow_constructible, NothrowExplicitClass,
double&, int&, double&>(true), "");
VERIFY( (test_property<is_nothrow_constructible, int[1]>(true)) );
static_assert(test_property<is_nothrow_constructible, int[1]>(true), "");
// Negative tests.
VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
void*>(false)) );
VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass>
(false)) );
VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
int, double>(false)) );
VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
void*>(false)) );
VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass>
(false)) );
VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
int, double>(false)) );
static_assert(test_property<is_nothrow_constructible, NoexceptExplicitClass,
void*>(false), "");
static_assert(test_property<is_nothrow_constructible, NoexceptExplicitClass>
(false), "");
static_assert(test_property<is_nothrow_constructible, NoexceptExplicitClass,
int, double>(false), "");
static_assert(test_property<is_nothrow_constructible, NothrowExplicitClass,
void*>(false), "");
static_assert(test_property<is_nothrow_constructible, NothrowExplicitClass>
(false), "");
static_assert(test_property<is_nothrow_constructible, NothrowExplicitClass,
int, double>(false), "");
VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
double&>(false)) );
VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
int&>(false)) );
VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
double&, int&, double&>(false)) );
VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
double&>(false)) );
VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
int&>(false)) );
VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
double&, int&, double&>(false)) );
static_assert(test_property<is_nothrow_constructible, ExceptExplicitClass,
double&>(false), "");
static_assert(test_property<is_nothrow_constructible, ExceptExplicitClass,
int&>(false), "");
static_assert(test_property<is_nothrow_constructible, ExceptExplicitClass,
double&, int&, double&>(false), "");
static_assert(test_property<is_nothrow_constructible, ThrowExplicitClass,
double&>(false), "");
static_assert(test_property<is_nothrow_constructible, ThrowExplicitClass,
int&>(false), "");
static_assert(test_property<is_nothrow_constructible, ThrowExplicitClass,
double&, int&, double&>(false), "");
VERIFY( (test_property<is_nothrow_constructible, int[]>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_nothrow_constructible, int[]>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
@ -19,65 +21,59 @@
// <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_nothrow_copy_assignable;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_property<is_nothrow_copy_assignable, int>(true)) );
VERIFY( (test_property<is_nothrow_copy_assignable, float>(true)) );
VERIFY( (test_property<is_nothrow_copy_assignable, EnumType>(true)) );
VERIFY( (test_property<is_nothrow_copy_assignable, int*>(true)) );
VERIFY( (test_property<is_nothrow_copy_assignable, int(*)(int)>(true)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
int (ClassType::*)>(true)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
int (ClassType::*) (int)>(true)) );
static_assert(test_property<is_nothrow_copy_assignable, int>(true), "");
static_assert(test_property<is_nothrow_copy_assignable, float>(true), "");
static_assert(test_property<is_nothrow_copy_assignable, EnumType>(true), "");
static_assert(test_property<is_nothrow_copy_assignable, int*>(true), "");
static_assert(test_property<is_nothrow_copy_assignable,
int(*)(int)>(true), "");
static_assert(test_property<is_nothrow_copy_assignable,
int (ClassType::*)>(true), "");
static_assert(test_property<is_nothrow_copy_assignable,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_nothrow_copy_assignable,
NoexceptCopyAssignClass>(true)) );
static_assert(test_property<is_nothrow_copy_assignable,
NoexceptCopyAssignClass>(true), "");
// Negative tests.
VERIFY( (test_property<is_nothrow_copy_assignable, void>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable, int[2]>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable, float[][3]>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
EnumType[2][3][4]>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable, int*[3]>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
int(*[][2])(int)>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
bool(ClassType) const>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
bool(...) &&>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
EnumType(int, ...)>(false)) );
static_assert(test_property<is_nothrow_copy_assignable, void>(false), "");
static_assert(test_property<is_nothrow_copy_assignable, int[2]>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
float[][3]>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
EnumType[2][3][4]>(false), "");
static_assert(test_property<is_nothrow_copy_assignable, int*[3]>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
int(*[][2])(int)>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
int (ClassType::*[2][3])>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
ClassType(unsigned) const &>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
bool(ClassType) const>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
bool(...) &&>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_nothrow_copy_assignable,
ExceptCopyAssignClass>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
NoexceptMoveAssignClass>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
ExceptMoveAssignClass>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
DeletedCopyAssignClass>(false)) );
VERIFY( (test_property<is_nothrow_copy_assignable,
DeletedMoveAssignClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_nothrow_copy_assignable,
ExceptCopyAssignClass>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
NoexceptMoveAssignClass>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
ExceptMoveAssignClass>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
DeletedCopyAssignClass>(false), "");
static_assert(test_property<is_nothrow_copy_assignable,
DeletedMoveAssignClass>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
@ -19,64 +21,61 @@
// <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_nothrow_copy_constructible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_nothrow_copy_constructible, int>(true)) );
VERIFY( (test_category<is_nothrow_copy_constructible, float>(true)) );
VERIFY( (test_category<is_nothrow_copy_constructible, EnumType>(true)) );
VERIFY( (test_category<is_nothrow_copy_constructible, int*>(true)) );
VERIFY( (test_category<is_nothrow_copy_constructible, int(*)(int)>(true)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
int (ClassType::*)>(true)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
int (ClassType::*) (int)>(true)) );
static_assert(test_category<is_nothrow_copy_constructible, int>(true), "");
static_assert(test_category<is_nothrow_copy_constructible, float>(true), "");
static_assert(test_category<is_nothrow_copy_constructible,
EnumType>(true), "");
static_assert(test_category<is_nothrow_copy_constructible, int*>(true), "");
static_assert(test_category<is_nothrow_copy_constructible,
int(*)(int)>(true), "");
static_assert(test_category<is_nothrow_copy_constructible,
int (ClassType::*)>(true), "");
static_assert(test_category<is_nothrow_copy_constructible,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_nothrow_copy_constructible,
NoexceptCopyConsClass>(true)) );
VERIFY( (test_property<is_nothrow_copy_constructible,
const NoexceptCopyConsClass>(true)) );
static_assert(test_property<is_nothrow_copy_constructible,
NoexceptCopyConsClass>(true), "");
static_assert(test_property<is_nothrow_copy_constructible,
const NoexceptCopyConsClass>(true), "");
// Negative tests.
VERIFY( (test_category<is_nothrow_copy_constructible, void>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible, int[2]>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible, int[]>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible, float[][3]>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
EnumType[2][3][4]>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible, int*[3]>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
int(*[][2])(int)>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
bool(ClassType) const>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
bool(...) &&>(false)) );
VERIFY( (test_category<is_nothrow_copy_constructible,
EnumType(int, ...)>(false)) );
static_assert(test_category<is_nothrow_copy_constructible, void>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
int[2]>(false), "");
static_assert(test_category<is_nothrow_copy_constructible, int[]>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
float[][3]>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
EnumType[2][3][4]>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
int*[3]>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
int(*[][2])(int)>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
int (ClassType::*[2][3])>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
ClassType(unsigned) const &>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
bool(ClassType) const>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
bool(...) &&>(false), "");
static_assert(test_category<is_nothrow_copy_constructible,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_nothrow_copy_constructible,
volatile NoexceptCopyConsClass>(false)) );
VERIFY( (test_property<is_nothrow_copy_constructible,
ThrowCopyConsClass>(false)) );
VERIFY( (test_property<is_nothrow_copy_constructible,
ExceptCopyConsClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_nothrow_copy_constructible,
volatile NoexceptCopyConsClass>(false), "");
static_assert(test_property<is_nothrow_copy_constructible,
ThrowCopyConsClass>(false), "");
static_assert(test_property<is_nothrow_copy_constructible,
ExceptCopyConsClass>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2004-12-29 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
@ -19,55 +21,55 @@
// <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_nothrow_default_constructible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_nothrow_default_constructible, int>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible, float>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible, EnumType>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible, int*>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible,
int(*)(int)>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible,
int (ClassType::*)>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible, int[2]>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible,
EnumType[2][3][4]>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible, int*[3]>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible,
int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<is_nothrow_default_constructible, ClassType>(true)) );
static_assert(test_category<is_nothrow_default_constructible, int>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
float>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
EnumType>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
int*>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
int(*)(int)>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
int (ClassType::*)>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
int (ClassType::*) (int)>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
int[2]>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
EnumType[2][3][4]>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
int*[3]>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
int (ClassType::*[2][3])>(true), "");
static_assert(test_category<is_nothrow_default_constructible,
ClassType>(true), "");
VERIFY( (test_category<is_nothrow_default_constructible,
NoexceptDefaultClass>(true)) );
static_assert(test_category<is_nothrow_default_constructible,
NoexceptDefaultClass>(true), "");
// Negative tests.
VERIFY( (test_category<is_nothrow_default_constructible, void>(false)) );
VERIFY( (test_category<is_nothrow_default_constructible, int[]>(false)) );
VERIFY( (test_category<is_nothrow_default_constructible,
float[][3]>(false)) );
VERIFY( (test_category<is_nothrow_default_constructible,
int(*[][2])(int)>(false)) );
VERIFY( (test_category<is_nothrow_default_constructible,
int (ClassType::*[][2][3]) (int)>(false)) );
static_assert(test_category<is_nothrow_default_constructible,
void>(false), "");
static_assert(test_category<is_nothrow_default_constructible,
int[]>(false), "");
static_assert(test_category<is_nothrow_default_constructible,
float[][3]>(false), "");
static_assert(test_category<is_nothrow_default_constructible,
int(*[][2])(int)>(false), "");
static_assert(test_category<is_nothrow_default_constructible,
int (ClassType::*[][2][3]) (int)>(false), "");
VERIFY( (test_category<is_nothrow_default_constructible,
ThrowDefaultClass>(false)) );
VERIFY( (test_category<is_nothrow_default_constructible,
ExceptDefaultClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_nothrow_default_constructible,
ThrowDefaultClass>(false), "");
static_assert(test_category<is_nothrow_default_constructible,
ExceptDefaultClass>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2011-05-19 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
@ -19,65 +21,59 @@
// <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_nothrow_move_assignable;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_property<is_nothrow_move_assignable, int>(true)) );
VERIFY( (test_property<is_nothrow_move_assignable, float>(true)) );
VERIFY( (test_property<is_nothrow_move_assignable, EnumType>(true)) );
VERIFY( (test_property<is_nothrow_move_assignable, int*>(true)) );
VERIFY( (test_property<is_nothrow_move_assignable, int(*)(int)>(true)) );
VERIFY( (test_property<is_nothrow_move_assignable,
int (ClassType::*)>(true)) );
VERIFY( (test_property<is_nothrow_move_assignable,
int (ClassType::*) (int)>(true)) );
static_assert(test_property<is_nothrow_move_assignable, int>(true), "");
static_assert(test_property<is_nothrow_move_assignable, float>(true), "");
static_assert(test_property<is_nothrow_move_assignable, EnumType>(true), "");
static_assert(test_property<is_nothrow_move_assignable, int*>(true), "");
static_assert(test_property<is_nothrow_move_assignable,
int(*)(int)>(true), "");
static_assert(test_property<is_nothrow_move_assignable,
int (ClassType::*)>(true), "");
static_assert(test_property<is_nothrow_move_assignable,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_nothrow_move_assignable,
NoexceptMoveAssignClass>(true)) );
VERIFY( (test_property<is_nothrow_move_assignable,
NoexceptCopyAssignClass>(true)) );
static_assert(test_property<is_nothrow_move_assignable,
NoexceptMoveAssignClass>(true), "");
static_assert(test_property<is_nothrow_move_assignable,
NoexceptCopyAssignClass>(true), "");
// Negative tests.
VERIFY( (test_property<is_nothrow_move_assignable, void>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable, int[2]>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable, float[][3]>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
EnumType[2][3][4]>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable, int*[3]>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
int(*[][2])(int)>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
bool(ClassType) const>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
bool(...) &&>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
EnumType(int, ...)>(false)) );
static_assert(test_property<is_nothrow_move_assignable, void>(false), "");
static_assert(test_property<is_nothrow_move_assignable, int[2]>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
float[][3]>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
EnumType[2][3][4]>(false), "");
static_assert(test_property<is_nothrow_move_assignable, int*[3]>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
int(*[][2])(int)>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
int (ClassType::*[2][3])>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
ClassType(unsigned) const &>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
bool(ClassType) const>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
bool(...) &&>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_nothrow_move_assignable,
ExceptMoveAssignClass>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
ExceptCopyAssignClass>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
DeletedMoveAssignClass>(false)) );
VERIFY( (test_property<is_nothrow_move_assignable,
DeletedCopyAssignClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_nothrow_move_assignable,
ExceptMoveAssignClass>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
ExceptCopyAssignClass>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
DeletedMoveAssignClass>(false), "");
static_assert(test_property<is_nothrow_move_assignable,
DeletedCopyAssignClass>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,64 +19,62 @@
// <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_nothrow_move_constructible;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_nothrow_move_constructible, int>(true)) );
VERIFY( (test_category<is_nothrow_move_constructible, float>(true)) );
VERIFY( (test_category<is_nothrow_move_constructible, EnumType>(true)) );
VERIFY( (test_category<is_nothrow_move_constructible, int*>(true)) );
VERIFY( (test_category<is_nothrow_move_constructible, int(*)(int)>(true)) );
VERIFY( (test_category<is_nothrow_move_constructible,
int (ClassType::*)>(true)) );
VERIFY( (test_category<is_nothrow_move_constructible,
int (ClassType::*) (int)>(true)) );
static_assert(test_category<is_nothrow_move_constructible, int>(true), "");
static_assert(test_category<is_nothrow_move_constructible, float>(true), "");
static_assert(test_category<is_nothrow_move_constructible,
EnumType>(true), "");
static_assert(test_category<is_nothrow_move_constructible, int*>(true), "");
static_assert(test_category<is_nothrow_move_constructible,
int(*)(int)>(true), "");
static_assert(test_category<is_nothrow_move_constructible,
int (ClassType::*)>(true), "");
static_assert(test_category<is_nothrow_move_constructible,
int (ClassType::*) (int)>(true), "");
VERIFY( (test_property<is_nothrow_move_constructible,
NoexceptMoveConsClass>(true)) );
static_assert(test_property<is_nothrow_move_constructible,
NoexceptMoveConsClass>(true), "");
// Negative tests.
VERIFY( (test_category<is_nothrow_move_constructible, void>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible, int[2]>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible, int[]>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible, float[][3]>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
EnumType[2][3][4]>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible, int*[3]>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
int(*[][2])(int)>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
int (ClassType::*[2][3])>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
ClassType(unsigned) const &>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
bool(ClassType) const>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
bool(...) &&>(false)) );
VERIFY( (test_category<is_nothrow_move_constructible,
EnumType(int, ...)>(false)) );
static_assert(test_category<is_nothrow_move_constructible, void>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
int[2]>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
int[]>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
float[][3]>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
EnumType[2][3][4]>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
int*[3]>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
int(*[][2])(int)>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
int (ClassType::*[2][3])>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
ClassType(unsigned) const &>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
bool(ClassType) const>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
bool(...) &&>(false), "");
static_assert(test_category<is_nothrow_move_constructible,
EnumType(int, ...)>(false), "");
VERIFY( (test_property<is_nothrow_move_constructible,
const NoexceptMoveConsClass>(false)) );
VERIFY( (test_property<is_nothrow_move_constructible,
volatile NoexceptMoveConsClass>(false)) );
VERIFY( (test_property<is_nothrow_move_constructible,
ThrowMoveConsClass>(false)) );
VERIFY( (test_property<is_nothrow_move_constructible,
ExceptMoveConsClass>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_property<is_nothrow_move_constructible,
const NoexceptMoveConsClass>(false), "");
static_assert(test_property<is_nothrow_move_constructible,
volatile NoexceptMoveConsClass>(false), "");
static_assert(test_property<is_nothrow_move_constructible,
ThrowMoveConsClass>(false), "");
static_assert(test_property<is_nothrow_move_constructible,
ExceptMoveConsClass>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2013-05-02 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2013 Free Software Foundation, Inc.
@ -19,42 +21,36 @@
// <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_null_pointer;
using namespace __gnu_test;
VERIFY( (test_category<is_null_pointer, std::nullptr_t>(true)) );
static_assert(test_category<is_null_pointer, std::nullptr_t>(true), "");
VERIFY( (test_category<is_null_pointer, int>(false)) );
VERIFY( (test_category<is_null_pointer, float>(false)) );
VERIFY( (test_category<is_null_pointer, EnumType>(false)) );
VERIFY( (test_category<is_null_pointer, int*>(false)) );
VERIFY( (test_category<is_null_pointer, int(*)(int)>(false)) );
VERIFY( (test_category<is_null_pointer, int (ClassType::*)>(false)) );
VERIFY( (test_category<is_null_pointer, int (ClassType::*) (int)>(false)) );
VERIFY( (test_category<is_null_pointer, int[2]>(false)) );
VERIFY( (test_category<is_null_pointer, float[][3]>(false)) );
VERIFY( (test_category<is_null_pointer, EnumType[2][3][4]>(false)) );
VERIFY( (test_category<is_null_pointer, int*[3]>(false)) );
VERIFY( (test_category<is_null_pointer, int(*[][2])(int)>(false)) );
VERIFY( (test_category<is_null_pointer, int (ClassType::*[2][3])>(false)) );
VERIFY( (test_category<is_null_pointer,
int (ClassType::*[][2][3]) (int)>(false)) );
VERIFY( (test_category<is_null_pointer, ClassType>(false)) );
VERIFY( (test_category<is_null_pointer, PODType>(false)) );
VERIFY( (test_category<is_null_pointer, void>(false)) );
VERIFY( (test_category<is_null_pointer, NType>(false)) );
VERIFY( (test_category<is_null_pointer, TType>(false)) );
VERIFY( (test_category<is_null_pointer, SLType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_null_pointer, int>(false), "");
static_assert(test_category<is_null_pointer, float>(false), "");
static_assert(test_category<is_null_pointer, EnumType>(false), "");
static_assert(test_category<is_null_pointer, int*>(false), "");
static_assert(test_category<is_null_pointer, int(*)(int)>(false), "");
static_assert(test_category<is_null_pointer, int (ClassType::*)>(false), "");
static_assert(test_category<is_null_pointer,
int (ClassType::*) (int)>(false), "");
static_assert(test_category<is_null_pointer, int[2]>(false), "");
static_assert(test_category<is_null_pointer, float[][3]>(false), "");
static_assert(test_category<is_null_pointer, EnumType[2][3][4]>(false), "");
static_assert(test_category<is_null_pointer, int*[3]>(false), "");
static_assert(test_category<is_null_pointer, int(*[][2])(int)>(false), "");
static_assert(test_category<is_null_pointer,
int (ClassType::*[2][3])>(false), "");
static_assert(test_category<is_null_pointer,
int (ClassType::*[][2][3]) (int)>(false), "");
static_assert(test_category<is_null_pointer, ClassType>(false), "");
static_assert(test_category<is_null_pointer, PODType>(false), "");
static_assert(test_category<is_null_pointer, void>(false), "");
static_assert(test_category<is_null_pointer, NType>(false), "");
static_assert(test_category<is_null_pointer, TType>(false), "");
static_assert(test_category<is_null_pointer, SLType>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@ -18,30 +19,23 @@
// <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_object;
using namespace __gnu_test;
VERIFY( (test_category<is_object, int (int)>(false)) );
VERIFY( (test_category<is_object, ClassType (ClassType)>(false)) );
VERIFY( (test_category<is_object, float (int, float, int[], int&)>(false)) );
VERIFY( (test_category<is_object, int&>(false)) );
VERIFY( (test_category<is_object, ClassType&>(false)) );
VERIFY( (test_category<is_object, int(&)(int)>(false)) );
VERIFY( (test_category<is_object, void>(false)) );
VERIFY( (test_category<is_object, const void>(false)) );
static_assert(test_category<is_object, int (int)>(false), "");
static_assert(test_category<is_object, ClassType (ClassType)>(false), "");
static_assert(test_category<is_object,
float (int, float, int[], int&)>(false), "");
static_assert(test_category<is_object, int&>(false), "");
static_assert(test_category<is_object, ClassType&>(false), "");
static_assert(test_category<is_object, int(&)(int)>(false), "");
static_assert(test_category<is_object, void>(false), "");
static_assert(test_category<is_object, const void>(false), "");
// Sanity check.
VERIFY( (test_category<is_object, ClassType>(true)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_object, ClassType>(true), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-02-21 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
@ -19,40 +21,33 @@
// <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_pod;
using namespace __gnu_test;
VERIFY( (test_category<is_pod, int>(true)) );
VERIFY( (test_category<is_pod, float>(true)) );
VERIFY( (test_category<is_pod, EnumType>(true)) );
VERIFY( (test_category<is_pod, int*>(true)) );
VERIFY( (test_category<is_pod, int(*)(int)>(true)) );
VERIFY( (test_category<is_pod, int (ClassType::*)>(true)) );
VERIFY( (test_category<is_pod, int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<is_pod, int[2]>(true)) );
VERIFY( (test_category<is_pod, float[][3]>(true)) );
VERIFY( (test_category<is_pod, EnumType[2][3][4]>(true)) );
VERIFY( (test_category<is_pod, int*[3]>(true)) );
VERIFY( (test_category<is_pod, int(*[][2])(int)>(true)) );
VERIFY( (test_category<is_pod, int (ClassType::*[2][3])>(true)) );
VERIFY( (test_category<is_pod, int (ClassType::*[][2][3]) (int)>(true)) );
VERIFY( (test_category<is_pod, ClassType>(true)) );
VERIFY( (test_category<is_pod, PODType>(true)) );
static_assert(test_category<is_pod, int>(true), "");
static_assert(test_category<is_pod, float>(true), "");
static_assert(test_category<is_pod, EnumType>(true), "");
static_assert(test_category<is_pod, int*>(true), "");
static_assert(test_category<is_pod, int(*)(int)>(true), "");
static_assert(test_category<is_pod, int (ClassType::*)>(true), "");
static_assert(test_category<is_pod, int (ClassType::*) (int)>(true), "");
static_assert(test_category<is_pod, int[2]>(true), "");
static_assert(test_category<is_pod, float[][3]>(true), "");
static_assert(test_category<is_pod, EnumType[2][3][4]>(true), "");
static_assert(test_category<is_pod, int*[3]>(true), "");
static_assert(test_category<is_pod, int(*[][2])(int)>(true), "");
static_assert(test_category<is_pod, int (ClassType::*[2][3])>(true), "");
static_assert(test_category<is_pod,
int (ClassType::*[][2][3]) (int)>(true), "");
static_assert(test_category<is_pod, ClassType>(true), "");
static_assert(test_category<is_pod, PODType>(true), "");
VERIFY( (test_category<is_pod, void>(false)) );
VERIFY( (test_category<is_pod, NType>(false)) );
VERIFY( (test_category<is_pod, TType>(false)) );
VERIFY( (test_category<is_pod, SLType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_pod, void>(false), "");
static_assert(test_category<is_pod, NType>(false), "");
static_assert(test_category<is_pod, TType>(false), "");
static_assert(test_category<is_pod, SLType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2007-06-02 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
@ -19,28 +21,21 @@
// <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_reference;
using namespace __gnu_test;
VERIFY( (test_category<is_reference, int&>(true)) );
VERIFY( (test_category<is_reference, ClassType&>(true)) );
VERIFY( (test_category<is_reference, int(&)(int)>(true)) );
VERIFY( (test_category<is_reference, int&&>(true)) );
VERIFY( (test_category<is_reference, ClassType&&>(true)) );
VERIFY( (test_category<is_reference, int(&&)(int)>(true)) );
static_assert(test_category<is_reference, int&>(true), "");
static_assert(test_category<is_reference, ClassType&>(true), "");
static_assert(test_category<is_reference, int(&)(int)>(true), "");
static_assert(test_category<is_reference, int&&>(true), "");
static_assert(test_category<is_reference, ClassType&&>(true), "");
static_assert(test_category<is_reference, int(&&)(int)>(true), "");
// Sanity check.
VERIFY( (test_category<is_reference, ClassType>(false)) );
static_assert(test_category<is_reference, ClassType>(false), "");
}
int main()
{
test01();
return 0;
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2007-06-02 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
@ -19,26 +21,18 @@
// <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_rvalue_reference;
using namespace __gnu_test;
VERIFY( (test_category<is_rvalue_reference, int&&>(true)) );
VERIFY( (test_category<is_rvalue_reference, ClassType&&>(true)) );
VERIFY( (test_category<is_rvalue_reference, int(&&)(int)>(true)) );
static_assert(test_category<is_rvalue_reference, int&&>(true), "");
static_assert(test_category<is_rvalue_reference, ClassType&&>(true), "");
static_assert(test_category<is_rvalue_reference, int(&&)(int)>(true), "");
// Sanity check.
VERIFY( (test_category<is_rvalue_reference, int&>(false)) );
VERIFY( (test_category<is_rvalue_reference, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_rvalue_reference, int&>(false), "");
static_assert(test_category<is_rvalue_reference, ClassType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-11-30 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
@ -19,30 +21,22 @@
// <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_scalar;
using namespace __gnu_test;
VERIFY( (test_category<is_scalar, int>(true)) );
VERIFY( (test_category<is_scalar, float>(true)) );
VERIFY( (test_category<is_scalar, EnumType>(true)) );
VERIFY( (test_category<is_scalar, int*>(true)) );
VERIFY( (test_category<is_scalar, int(*)(int)>(true)) );
VERIFY( (test_category<is_scalar, int (ClassType::*)>(true)) );
VERIFY( (test_category<is_scalar, int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<is_scalar, std::nullptr_t>(true)) );
static_assert(test_category<is_scalar, int>(true), "");
static_assert(test_category<is_scalar, float>(true), "");
static_assert(test_category<is_scalar, EnumType>(true), "");
static_assert(test_category<is_scalar, int*>(true), "");
static_assert(test_category<is_scalar, int(*)(int)>(true), "");
static_assert(test_category<is_scalar, int (ClassType::*)>(true), "");
static_assert(test_category<is_scalar, int (ClassType::*) (int)>(true), "");
static_assert(test_category<is_scalar, std::nullptr_t>(true), "");
// Sanity check.
VERIFY( (test_category<is_scalar, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_scalar, ClassType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2005-01-24 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005-2013 Free Software Foundation, Inc.
@ -19,52 +21,45 @@
// <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_signed;
using namespace __gnu_test;
VERIFY( (test_category<is_signed, void>(false)) );
static_assert(test_category<is_signed, void>(false), "");
VERIFY( (test_category<is_signed, char>(char(-1) < char(0))) );
VERIFY( (test_category<is_signed, signed char>(true)) );
VERIFY( (test_category<is_signed, unsigned char>(false)) );
static_assert(test_category<is_signed, char>(char(-1) < char(0)), "");
static_assert(test_category<is_signed, signed char>(true), "");
static_assert(test_category<is_signed, unsigned char>(false), "");
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_signed, wchar_t>(wchar_t(-1) < wchar_t(0))) );
static_assert(test_category<is_signed, wchar_t>
(wchar_t(-1) < wchar_t(0)), "");
#endif
VERIFY( (test_category<is_signed, short>(true)) );
VERIFY( (test_category<is_signed, unsigned short>(false)) );
VERIFY( (test_category<is_signed, int>(true)) );
VERIFY( (test_category<is_signed, unsigned int>(false)) );
VERIFY( (test_category<is_signed, long>(true)) );
VERIFY( (test_category<is_signed, unsigned long>(false)) );
VERIFY( (test_category<is_signed, long long>(true)) );
VERIFY( (test_category<is_signed, unsigned long long>(false)) );
static_assert(test_category<is_signed, short>(true), "");
static_assert(test_category<is_signed, unsigned short>(false), "");
static_assert(test_category<is_signed, int>(true), "");
static_assert(test_category<is_signed, unsigned int>(false), "");
static_assert(test_category<is_signed, long>(true), "");
static_assert(test_category<is_signed, unsigned long>(false), "");
static_assert(test_category<is_signed, long long>(true), "");
static_assert(test_category<is_signed, unsigned long long>(false), "");
VERIFY( (test_category<is_signed, float>(true)) );
VERIFY( (test_category<is_signed, double>(true)) );
VERIFY( (test_category<is_signed, long double>(true)) );
static_assert(test_category<is_signed, float>(true), "");
static_assert(test_category<is_signed, double>(true), "");
static_assert(test_category<is_signed, long double>(true), "");
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
VERIFY( (test_category<is_signed, __int128>(true)) );
VERIFY( (test_category<is_signed, unsigned __int128>(false)) );
static_assert(test_category<is_signed, __int128>(true), "");
static_assert(test_category<is_signed, unsigned __int128>(false), "");
#endif
#ifdef _GLIBCXX_USE_FLOAT128
VERIFY( (test_category<is_signed, __float128>(true)) );
static_assert(test_category<is_signed, __float128>(true), "");
#endif
// Sanity check.
VERIFY( (test_category<is_signed, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_signed, ClassType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-03-23 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
@ -19,24 +21,16 @@
// <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_standard_layout;
using namespace __gnu_test;
VERIFY( (test_category<is_standard_layout, SLType>(true)) );
VERIFY( (test_category<is_standard_layout, PODType>(true)) );
static_assert(test_category<is_standard_layout, SLType>(true), "");
static_assert(test_category<is_standard_layout, PODType>(true), "");
VERIFY( (test_category<is_standard_layout, NType>(false)) );
VERIFY( (test_category<is_standard_layout, TType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_standard_layout, NType>(false), "");
static_assert(test_category<is_standard_layout, TType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2010-03-23 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
@ -19,24 +21,16 @@
// <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_trivial;
using namespace __gnu_test;
VERIFY( (test_category<is_trivial, TType>(true)) );
VERIFY( (test_category<is_trivial, PODType>(true)) );
static_assert(test_category<is_trivial, TType>(true), "");
static_assert(test_category<is_trivial, PODType>(true), "");
VERIFY( (test_category<is_trivial, NType>(false)) );
VERIFY( (test_category<is_trivial, SLType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_trivial, NType>(false), "");
static_assert(test_category<is_trivial, SLType>(false), "");
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
//
// 2012-04-15 Paolo Carlini <paolo.carlini@oracle.com>
//
@ -20,25 +21,17 @@
// <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)) );
static_assert(test_category<is_trivially_destructible, int>(true), "");
static_assert(test_category<is_trivially_destructible, TType>(true), "");
static_assert(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;
static_assert(test_category<is_trivially_destructible, NType>(false), "");
static_assert(test_category<is_trivially_destructible, SLType>(false), "");
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2005-01-24 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005-2013 Free Software Foundation, Inc.
@ -19,52 +21,45 @@
// <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_unsigned;
using namespace __gnu_test;
VERIFY( (test_category<is_unsigned, void>(false)) );
VERIFY( (test_category<is_unsigned, char>(char(-1) > char(0))) );
VERIFY( (test_category<is_unsigned, signed char>(false)) );
VERIFY( (test_category<is_unsigned, unsigned char>(true)) );
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_unsigned, wchar_t>(wchar_t(-1) > wchar_t(0))) );
#endif
VERIFY( (test_category<is_unsigned, short>(false)) );
VERIFY( (test_category<is_unsigned, unsigned short>(true)) );
VERIFY( (test_category<is_unsigned, int>(false)) );
VERIFY( (test_category<is_unsigned, unsigned int>(true)) );
VERIFY( (test_category<is_unsigned, long>(false)) );
VERIFY( (test_category<is_unsigned, unsigned long>(true)) );
VERIFY( (test_category<is_unsigned, long long>(false)) );
VERIFY( (test_category<is_unsigned, unsigned long long>(true)) );
VERIFY( (test_category<is_unsigned, float>(false)) );
VERIFY( (test_category<is_unsigned, double>(false)) );
VERIFY( (test_category<is_unsigned, long double>(false)) );
static_assert(test_category<is_unsigned, void>(false), "");
static_assert(test_category<is_unsigned, char>(char(-1) > char(0)), "");
static_assert(test_category<is_unsigned, signed char>(false), "");
static_assert(test_category<is_unsigned, unsigned char>(true), "");
#ifdef _GLIBCXX_USE_WCHAR_T
static_assert(test_category<is_unsigned, wchar_t>
(wchar_t(-1) > wchar_t(0)), "");
#endif
static_assert(test_category<is_unsigned, short>(false), "");
static_assert(test_category<is_unsigned, unsigned short>(true), "");
static_assert(test_category<is_unsigned, int>(false), "");
static_assert(test_category<is_unsigned, unsigned int>(true), "");
static_assert(test_category<is_unsigned, long>(false), "");
static_assert(test_category<is_unsigned, unsigned long>(true), "");
static_assert(test_category<is_unsigned, long long>(false), "");
static_assert(test_category<is_unsigned, unsigned long long>(true), "");
static_assert(test_category<is_unsigned, float>(false), "");
static_assert(test_category<is_unsigned, double>(false), "");
static_assert(test_category<is_unsigned, long double>(false), "");
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
VERIFY( (test_category<is_unsigned, unsigned __int128>(true)) );
VERIFY( (test_category<is_unsigned, __int128>(false)) );
static_assert(test_category<is_unsigned, unsigned __int128>(true), "");
static_assert(test_category<is_unsigned, __int128>(false), "");
#endif
#ifdef _GLIBCXX_USE_FLOAT128
VERIFY( (test_category<is_unsigned, __float128>(false)) );
static_assert(test_category<is_unsigned, __float128>(false), "");
#endif
// Sanity check.
VERIFY( (test_category<is_unsigned, ClassType>(false)) );
}
int main()
{
test01();
return 0;
static_assert(test_category<is_unsigned, ClassType>(false), "");
}

View File

@ -1,5 +1,6 @@
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" }
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux-* } }
// { dg-do compile }
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
//
@ -21,53 +22,46 @@
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
// Ensure that this enum has "short" as its underlying type.
enum test_enum { first_selection = ((unsigned char)-1) + 1 };
void test01()
{
bool test __attribute__((unused)) = true;
using std::make_signed;
using std::is_same;
// Positive tests.
typedef make_signed<const int>::type test2_type;
VERIFY( (is_same<test2_type, const int>::value) );
static_assert(is_same<test2_type, const int>::value, "");
typedef make_signed<const unsigned int>::type test21c_type;
VERIFY( (is_same<test21c_type, const signed int>::value) );
static_assert(is_same<test21c_type, const signed int>::value, "");
typedef make_signed<volatile unsigned int>::type test21v_type;
VERIFY( (is_same<test21v_type, volatile signed int>::value) );
static_assert(is_same<test21v_type, volatile signed int>::value, "");
typedef make_signed<const volatile unsigned int>::type test21cv_type;
VERIFY( (is_same<test21cv_type, const volatile signed int>::value) );
static_assert(is_same<test21cv_type,
const volatile signed int>::value, "");
typedef make_signed<const char>::type test22_type;
VERIFY( (is_same<test22_type, const signed char>::value) );
static_assert(is_same<test22_type, const signed char>::value, "");
#ifdef _GLIBCXX_USE_WCHAR_T
typedef make_signed<volatile wchar_t>::type test23_type;
VERIFY( (is_same<test23_type, volatile signed wchar_t>::value) );
static_assert(is_same<test23_type, volatile signed wchar_t>::value, "");
#endif
typedef make_signed<test_enum>::type test24_type;
VERIFY( (is_same<test24_type, short>::value) );
static_assert(is_same<test24_type, short>::value, "");
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
typedef make_signed<unsigned __int128>::type test25_type;
VERIFY( (is_same<test25_type, __int128>::value) );
static_assert(is_same<test25_type, __int128>::value, "");
typedef make_signed<__int128>::type test26_type;
VERIFY( (is_same<test26_type, __int128>::value) );
static_assert(is_same<test26_type, __int128>::value, "");
#endif
}
int main()
{
test01();
return 0;
}

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
//
@ -20,56 +21,49 @@
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
enum test_enum { first_selection };
void test01()
{
bool test __attribute__((unused)) = true;
using std::make_unsigned;
using std::is_same;
using std::is_unsigned;
// Positive tests.
typedef make_unsigned<const unsigned int>::type test2_type;
VERIFY( (is_same<test2_type, const unsigned int>::value) );
static_assert(is_same<test2_type, const unsigned int>::value, "");
typedef make_unsigned<const signed int>::type test21c_type;
VERIFY( (is_same<test21c_type, const unsigned int>::value) );
static_assert(is_same<test21c_type, const unsigned int>::value, "");
typedef make_unsigned<volatile signed int>::type test21v_type;
VERIFY( (is_same<test21v_type, volatile unsigned int>::value) );
static_assert(is_same<test21v_type, volatile unsigned int>::value, "");
typedef make_unsigned<const volatile signed int>::type test21cv_type;
VERIFY( (is_same<test21cv_type, const volatile unsigned int>::value) );
static_assert(is_same<test21cv_type,
const volatile unsigned int>::value, "");
typedef make_unsigned<const char>::type test22_type;
VERIFY( (is_same<test22_type, const unsigned char>::value) );
static_assert(is_same<test22_type, const unsigned char>::value, "");
#ifdef _GLIBCXX_USE_WCHAR_T
typedef make_unsigned<volatile wchar_t>::type test23_type;
VERIFY( (is_same<test23_type, volatile wchar_t>::value) );
static_assert(is_same<test23_type, volatile wchar_t>::value, "");
#endif
// Chapter 48, chapter 20. Smallest rank such that new unsigned type
// same size.
typedef make_unsigned<test_enum>::type test24_type;
VERIFY( is_unsigned<test24_type>::value );
VERIFY( sizeof(test24_type) == sizeof(test_enum) );
static_assert(is_unsigned<test24_type>::value, "");
static_assert(sizeof(test24_type) == sizeof(test_enum), "");
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
typedef make_unsigned<unsigned __int128>::type test25_type;
VERIFY( (is_same<test25_type, unsigned __int128>::value) );
static_assert(is_same<test25_type, unsigned __int128>::value, "");
typedef make_unsigned<__int128>::type test26_type;
VERIFY( (is_same<test26_type, unsigned __int128>::value) );
static_assert(is_same<test26_type, unsigned __int128>::value, "");
#endif
}
int main()
{
test01();
return 0;
}

View File

@ -1,5 +1,6 @@
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" }
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux-* } }
// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums" }
// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux-* } }
// { dg-do compile }
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
//
@ -21,53 +22,46 @@
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
// Ensure that this enum has "short" as its underlying type.
enum test_enum { first_selection = ((unsigned char)-1) + 1 };
void test01()
{
bool test __attribute__((unused)) = true;
using std::make_unsigned;
using std::is_same;
// Positive tests.
typedef make_unsigned<const unsigned int>::type test2_type;
VERIFY( (is_same<test2_type, const unsigned int>::value) );
static_assert(is_same<test2_type, const unsigned int>::value, "");
typedef make_unsigned<const signed int>::type test21c_type;
VERIFY( (is_same<test21c_type, const unsigned int>::value) );
static_assert(is_same<test21c_type, const unsigned int>::value, "");
typedef make_unsigned<volatile signed int>::type test21v_type;
VERIFY( (is_same<test21v_type, volatile unsigned int>::value) );
static_assert(is_same<test21v_type, volatile unsigned int>::value, "");
typedef make_unsigned<const volatile signed int>::type test21cv_type;
VERIFY( (is_same<test21cv_type, const volatile unsigned int>::value) );
static_assert(is_same<test21cv_type,
const volatile unsigned int>::value, "");
typedef make_unsigned<const char>::type test22_type;
VERIFY( (is_same<test22_type, const unsigned char>::value) );
static_assert(is_same<test22_type, const unsigned char>::value, "");
#ifdef _GLIBCXX_USE_WCHAR_T
typedef make_unsigned<volatile wchar_t>::type test23_type;
VERIFY( (is_same<test23_type, volatile wchar_t>::value) );
static_assert(is_same<test23_type, volatile wchar_t>::value, "");
#endif
typedef make_unsigned<test_enum>::type test24_type;
VERIFY( (is_same<test24_type, unsigned short>::value) );
static_assert(is_same<test24_type, unsigned short>::value, "");
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
typedef make_unsigned<unsigned __int128>::type test25_type;
VERIFY( (is_same<test25_type, unsigned __int128>::value) );
static_assert(is_same<test25_type, unsigned __int128>::value, "");
typedef make_unsigned<__int128>::type test26_type;
VERIFY( (is_same<test26_type, unsigned __int128>::value) );
static_assert(is_same<test26_type, unsigned __int128>::value, "");
#endif
}
int main()
{
test01();
return 0;
}

View File

@ -1,4 +1,6 @@
// { dg-options "-std=gnu++0x" }
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// 2007-06-02 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
@ -19,34 +21,34 @@
// <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::remove_reference;
using std::is_same;
using namespace __gnu_test;
VERIFY( (is_same<remove_reference<int&>::type, int>::value) );
VERIFY( (is_same<remove_reference<int>::type, int>::value) );
VERIFY( (is_same<remove_reference<const int&>::type, const int>::value) );
VERIFY( (is_same<remove_reference<int*&>::type, int*>::value) );
VERIFY( (is_same<remove_reference<ClassType&>::type, ClassType>::value) );
VERIFY( (is_same<remove_reference<ClassType>::type, ClassType>::value) );
VERIFY( (is_same<remove_reference<int(&)(int)>::type, int(int)>::value) );
VERIFY( (is_same<remove_reference<int&&>::type, int>::value) );
VERIFY( (is_same<remove_reference<int>::type, int>::value) );
VERIFY( (is_same<remove_reference<const int&&>::type, const int>::value) );
VERIFY( (is_same<remove_reference<int*&&>::type, int*>::value) );
VERIFY( (is_same<remove_reference<ClassType&&>::type, ClassType>::value) );
VERIFY( (is_same<remove_reference<ClassType>::type, ClassType>::value) );
VERIFY( (is_same<remove_reference<int(&&)(int)>::type, int(int)>::value) );
}
int main()
{
test01();
return 0;
static_assert(is_same<remove_reference<int&>::type, int>::value, "");
static_assert(is_same<remove_reference<int>::type, int>::value, "");
static_assert(is_same<remove_reference<const int&>::type,
const int>::value, "");
static_assert(is_same<remove_reference<int*&>::type, int*>::value, "");
static_assert(is_same<remove_reference<ClassType&>::type,
ClassType>::value, "");
static_assert(is_same<remove_reference<ClassType>::type,
ClassType>::value, "");
static_assert(is_same<remove_reference<int(&)(int)>::type,
int(int)>::value, "");
static_assert(is_same<remove_reference<int&&>::type, int>::value, "");
static_assert(is_same<remove_reference<int>::type, int>::value, "");
static_assert(is_same<remove_reference<const int&&>::type,
const int>::value, "");
static_assert(is_same<remove_reference<int*&&>::type, int*>::value, "");
static_assert(is_same<remove_reference<ClassType&&>::type,
ClassType>::value, "");
static_assert(is_same<remove_reference<ClassType>::type,
ClassType>::value, "");
static_assert(is_same<remove_reference<int(&&)(int)>::type,
int(int)>::value, "");
}

View File

@ -28,66 +28,68 @@ namespace __gnu_test
{
// For tr1/type_traits.
template<template<typename> class Category, typename Type>
#if __cplusplus >= 201103L
constexpr
#endif
bool
test_category(bool value)
{
bool ret = true;
ret &= Category<Type>::value == value;
ret &= Category<const Type>::value == value;
ret &= Category<volatile Type>::value == value;
ret &= Category<const volatile Type>::value == value;
ret &= Category<Type>::type::value == value;
ret &= Category<const Type>::type::value == value;
ret &= Category<volatile Type>::type::value == value;
ret &= Category<const volatile Type>::type::value == value;
return ret;
return (Category<Type>::value == value
&& Category<const Type>::value == value
&& Category<volatile Type>::value == value
&& Category<const volatile Type>::value == value
&& Category<Type>::type::value == value
&& Category<const Type>::type::value == value
&& Category<volatile Type>::type::value == value
&& Category<const volatile Type>::type::value == value);
}
template<template<typename> class Property, typename Type>
#if __cplusplus >= 201103L
constexpr
#endif
bool
test_property(typename Property<Type>::value_type value)
{
bool ret = true;
ret &= Property<Type>::value == value;
ret &= Property<Type>::type::value == value;
return ret;
return (Property<Type>::value == value
&& Property<Type>::type::value == value);
}
// For testing tr1/type_traits/extent, which has a second template
// parameter.
template<template<typename, unsigned> class Property,
typename Type, unsigned Uint>
#if __cplusplus >= 201103L
constexpr
#endif
bool
test_property(typename Property<Type, Uint>::value_type value)
{
bool ret = true;
ret &= Property<Type, Uint>::value == value;
ret &= Property<Type, Uint>::type::value == value;
return ret;
return (Property<Type, Uint>::value == value
&& Property<Type, Uint>::type::value == value);
}
#if __cplusplus >= 201103L
template<template<typename...> class Property,
typename Type1, typename... Types>
bool
constexpr bool
test_property(typename Property<Type1, Types...>::value_type value)
{
bool ret = true;
ret &= Property<Type1, Types...>::value == value;
ret &= Property<Type1, Types...>::type::value == value;
return ret;
return (Property<Type1, Types...>::value == value
&& Property<Type1, Types...>::type::value == value);
}
#endif
template<template<typename, typename> class Relationship,
typename Type1, typename Type2>
#if __cplusplus >= 201103L
constexpr
#endif
bool
test_relationship(bool value)
{
bool ret = true;
ret &= Relationship<Type1, Type2>::value == value;
ret &= Relationship<Type1, Type2>::type::value == value;
return ret;
return (Relationship<Type1, Type2>::value == value
&& Relationship<Type1, Type2>::type::value == value);
}
// Test types.