explicit_instantiation.cc: New.

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

	* testsuite/20_util/add_const/requirements/explicit_instantiation.cc:
	New.
	* testsuite/20_util/add_const/value.cc: Likewise.
	* testsuite/20_util/add_cv/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/add_cv/value.cc: Likewise.
	* testsuite/20_util/add_pointer/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/add_pointer/value.cc: Likewise.
	* testsuite/20_util/add_volatile/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/add_volatile/value.cc: Likewise.
	* testsuite/20_util/alignment_of/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/alignment_of/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/alignment_of/value.cc: Likewise.
	* testsuite/20_util/extent/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/extent/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/extent/value.cc: Likewise.
	* testsuite/20_util/has_virtual_destructor/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/has_virtual_destructor/requirements/
	typedefs.cc: Likewise.
	* testsuite/20_util/has_virtual_destructor/value.cc: Likewise.
	* testsuite/20_util/is_abstract/requirements/explicit_instantiation.cc:
 	Likewise.
	* testsuite/20_util/is_abstract/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_abstract/value.cc: Likewise.
	* testsuite/20_util/is_arithmetic/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_arithmetic/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_arithmetic/value.cc: Likewise.
	* testsuite/20_util/is_array/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_array/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_array/value.cc: Likewise.
	* testsuite/20_util/is_base_of/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_base_of/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_base_of/value.cc: Likewise.
	* testsuite/20_util/is_class/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_class/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_class/value.cc: Likewise.
	* testsuite/20_util/is_const/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_const/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_const/value.cc: Likewise.
	* testsuite/20_util/is_empty/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_empty/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_empty/value.cc: Likewise.
	* testsuite/20_util/is_enum/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_enum/requirements/typedefs.cc
	* testsuite/20_util/is_enum/value.cc: Likewise.
	* testsuite/20_util/is_pointer/requirements/explicit_instantiation.cc
	* testsuite/20_util/is_pointer/value.cc: Likewise.
	* testsuite/20_util/is_polymorphic/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_polymorphic/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_polymorphic/value.cc: Likewise.
	* testsuite/20_util/is_same/requirements/explicit_instantiation.cc
	* testsuite/20_util/is_same/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_same/value.cc: Likewise.
	* testsuite/20_util/is_union/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_union/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_union/value.cc: Likewise.
	* testsuite/20_util/is_void/requirements/explicit_instantiation.cc
	* testsuite/20_util/is_void/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_void/value.cc: Likewise.
	* testsuite/20_util/is_volatile/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_volatile/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_volatile/value.cc: Likewise.
	* testsuite/20_util/rank/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/rank/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/rank/value.cc: Likewise.
	* testsuite/20_util/remove_all_extents/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/remove_all_extents/value.cc: Likewise.
	* testsuite/20_util/remove_const/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/remove_const/value.cc: Likewise.
	* testsuite/20_util/remove_cv/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/remove_cv/value.cc: Likewise.
	* testsuite/20_util/remove_extent/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/remove_extent/value.cc: Likewise.
	* testsuite/20_util/remove_pointer/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/remove_pointer/value.cc: Likewise.
	* testsuite/20_util/remove_volatile/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/remove_volatile/value.cc: Likewise.

From-SVN: r205789
This commit is contained in:
Paolo Carlini 2013-12-08 09:44:48 +00:00 committed by Paolo Carlini
parent 7cf0b2a659
commit ae29d0253f
74 changed files with 2778 additions and 0 deletions

View File

@ -1,3 +1,105 @@
2013-12-08 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/20_util/add_const/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/add_const/value.cc: Likewise.
* testsuite/20_util/add_cv/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/add_cv/value.cc: Likewise.
* testsuite/20_util/add_pointer/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/add_pointer/value.cc: Likewise.
* testsuite/20_util/add_volatile/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/add_volatile/value.cc: Likewise.
* testsuite/20_util/alignment_of/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/alignment_of/requirements/typedefs.cc: Likewise.
* testsuite/20_util/alignment_of/value.cc: Likewise.
* testsuite/20_util/extent/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/extent/requirements/typedefs.cc: Likewise.
* testsuite/20_util/extent/value.cc: Likewise.
* testsuite/20_util/has_virtual_destructor/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/has_virtual_destructor/requirements/
typedefs.cc: Likewise.
* testsuite/20_util/has_virtual_destructor/value.cc: Likewise.
* testsuite/20_util/is_abstract/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_abstract/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_abstract/value.cc: Likewise.
* testsuite/20_util/is_arithmetic/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_arithmetic/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_arithmetic/value.cc: Likewise.
* testsuite/20_util/is_array/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_array/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_array/value.cc: Likewise.
* testsuite/20_util/is_base_of/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_base_of/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_base_of/value.cc: Likewise.
* testsuite/20_util/is_class/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_class/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_class/value.cc: Likewise.
* testsuite/20_util/is_const/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_const/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_const/value.cc: Likewise.
* testsuite/20_util/is_empty/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_empty/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_empty/value.cc: Likewise.
* testsuite/20_util/is_enum/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_enum/requirements/typedefs.cc
* testsuite/20_util/is_enum/value.cc: Likewise.
* testsuite/20_util/is_pointer/requirements/explicit_instantiation.cc
* testsuite/20_util/is_pointer/value.cc: Likewise.
* testsuite/20_util/is_polymorphic/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_polymorphic/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_polymorphic/value.cc: Likewise.
* testsuite/20_util/is_same/requirements/explicit_instantiation.cc
* testsuite/20_util/is_same/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_same/value.cc: Likewise.
* testsuite/20_util/is_union/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_union/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_union/value.cc: Likewise.
* testsuite/20_util/is_void/requirements/explicit_instantiation.cc
* testsuite/20_util/is_void/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_void/value.cc: Likewise.
* testsuite/20_util/is_volatile/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_volatile/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_volatile/value.cc: Likewise.
* testsuite/20_util/rank/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/rank/requirements/typedefs.cc: Likewise.
* testsuite/20_util/rank/value.cc: Likewise.
* testsuite/20_util/remove_all_extents/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/remove_all_extents/value.cc: Likewise.
* testsuite/20_util/remove_const/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/remove_const/value.cc: Likewise.
* testsuite/20_util/remove_cv/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/remove_cv/value.cc: Likewise.
* testsuite/20_util/remove_extent/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/remove_extent/value.cc: Likewise.
* testsuite/20_util/remove_pointer/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/remove_pointer/value.cc: Likewise.
* testsuite/20_util/remove_volatile/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/remove_volatile/value.cc: Likewise.
2013-12-06 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/util/testsuite_tr1.h (test_category, test_property,

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct add_const<test_type>;
}

View File

@ -0,0 +1,48 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::add_const;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<add_const<int>::type, const int>::value, "");
static_assert(is_same<add_const<volatile int>::type,
const volatile int>::value, "");
static_assert(is_same<add_const<int*>::type, int* const>::value, "");
static_assert(is_same<add_const<int&>::type, int&>::value, "");
static_assert(is_same<add_const<int (int)>::type, int (int)>::value, "");
static_assert(is_same<add_const<const int>::type, const int>::value, "");
static_assert(is_same<add_const<ClassType>::type,
const ClassType>::value, "");
static_assert(is_same<add_const<volatile ClassType>::type,
const volatile ClassType>::value, "");
static_assert(is_same<add_const<ClassType*>::type,
ClassType* const>::value, "");
static_assert(is_same<add_const<ClassType&>::type, ClassType&>::value, "");
static_assert(is_same<add_const<ClassType (ClassType)>::type,
ClassType (ClassType)>::value, "");
static_assert(is_same<add_const<const ClassType>::type,
const ClassType>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct add_cv<test_type>;
}

View File

@ -0,0 +1,49 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::add_cv;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<add_cv<int>::type, const volatile int>::value, "");
static_assert(is_same<add_cv<const int>::type,
const volatile int>::value, "");
static_assert(is_same<add_cv<int*>::type, int* const volatile>::value, "");
static_assert(is_same<add_cv<int&>::type, int&>::value, "");
static_assert(is_same<add_cv<int (int)>::type, int (int)>::value, "");
static_assert(is_same<add_cv<const volatile int>::type,
const volatile int>::value, "");
static_assert(is_same<add_cv<ClassType>::type,
const volatile ClassType>::value, "");
static_assert(is_same<add_cv<volatile ClassType>::type,
const volatile ClassType>::value, "");
static_assert(is_same<add_cv<ClassType*>::type,
ClassType* const volatile>::value, "");
static_assert(is_same<add_cv<ClassType&>::type, ClassType&>::value, "");
static_assert(is_same<add_cv<ClassType (ClassType)>::type,
ClassType (ClassType)>::value, "");
static_assert(is_same<add_cv<const volatile ClassType>::type,
const volatile ClassType>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct add_pointer<test_type>;
}

View File

@ -0,0 +1,37 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::add_pointer;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<add_pointer<int>::type, int*>::value, "");
static_assert(is_same<add_pointer<int*>::type, int**>::value, "");
static_assert(is_same<add_pointer<const int>::type, const int*>::value, "");
static_assert(is_same<add_pointer<int&>::type, int*>::value, "");
static_assert(is_same<add_pointer<ClassType*>::type,
ClassType**>::value, "");
static_assert(is_same<add_pointer<ClassType>::type, ClassType*>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct add_volatile<test_type>;
}

View File

@ -0,0 +1,49 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::add_volatile;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<add_volatile<int>::type, volatile int>::value, "");
static_assert(is_same<add_volatile<const int>::type,
const volatile int>::value, "");
static_assert(is_same<add_volatile<int*>::type, int* volatile>::value, "");
static_assert(is_same<add_volatile<int&>::type, int&>::value, "");
static_assert(is_same<add_volatile<int (int)>::type, int (int)>::value, "");
static_assert(is_same<add_volatile<volatile int>::type,
volatile int>::value, "");
static_assert(is_same<add_volatile<ClassType>::type,
volatile ClassType>::value, "");
static_assert(is_same<add_volatile<const ClassType>::type,
const volatile ClassType>::value, "");
static_assert(is_same<add_volatile<ClassType*>::type,
ClassType* volatile>::value, "");
static_assert(is_same<add_volatile<ClassType&>::type, ClassType&>::value, "");
static_assert(is_same<add_volatile<ClassType (ClassType)>::type,
ClassType (ClassType)>::value, "");
static_assert(is_same<add_volatile<volatile ClassType>::type,
volatile ClassType>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct alignment_of<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::alignment_of<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,36 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::alignment_of;
using namespace __gnu_test;
static_assert(test_property<alignment_of, char>(__alignof__(char)), "");
static_assert(test_property<alignment_of, short>(__alignof__(short)), "");
static_assert(test_property<alignment_of, int>(__alignof__(int)), "");
static_assert(test_property<alignment_of, double>(__alignof__(double)), "");
static_assert(test_property<alignment_of, int[4]>(__alignof__(int[4])), "");
static_assert(test_property<alignment_of,
ClassType>(__alignof__(ClassType)), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct extent<test_type, 2>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::extent<int, 1> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,47 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::extent;
using namespace __gnu_test;
static_assert(test_property<extent, int, 0>(0), "");
static_assert(test_property<extent, int[2], 0>(2), "");
static_assert(test_property<extent, int[2][4], 0>(2), "");
static_assert(test_property<extent, int[][4], 0>(0), "");
static_assert(extent<int, 1>::value == 0, "");
static_assert(extent<int[2], 1>::value == 0, "");
static_assert(extent<int[2][4], 1>::value == 4, "");
static_assert(extent<int[][4], 1>::value == 4, "");
static_assert(extent<int[10][4][6][8][12][2], 4>::value == 12, "");
static_assert(test_property<extent, ClassType, 0>(0), "");
static_assert(test_property<extent, ClassType[2], 0>(2), "");
static_assert(test_property<extent, ClassType[2][4], 0>(2), "");
static_assert(test_property<extent, ClassType[][4], 0>(0), "");
static_assert(extent<ClassType, 1>::value == 0, "");
static_assert(extent<ClassType[2], 1>::value == 0, "");
static_assert(extent<ClassType[2][4], 1>::value == 4, "");
static_assert(extent<ClassType[][4], 1>::value == 4, "");
static_assert(extent<ClassType[10][4][6][8][12][2], 4>::value == 12, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct has_virtual_destructor<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::has_virtual_destructor<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,50 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <iostream>
#include <testsuite_tr1.h>
void test01()
{
using std::has_virtual_destructor;
using namespace __gnu_test;
// Positive tests.
static_assert(test_category<has_virtual_destructor,
VirtualDestructorClass>(true), "");
static_assert(test_category<has_virtual_destructor, std::iostream>(true), "");
static_assert(test_category<has_virtual_destructor,
std::streambuf>(true), "");
// Negative tests.
static_assert(test_category<has_virtual_destructor,
PolymorphicClass>(false), "");
static_assert(test_category<has_virtual_destructor,
DerivedPolymorphic>(false), "");
static_assert(test_category<has_virtual_destructor,
AbstractClass>(false), "");
static_assert(test_category<has_virtual_destructor, void>(false), "");
static_assert(test_category<has_virtual_destructor, int (int)>(false), "");
static_assert(test_category<has_virtual_destructor, int&>(false), "");
static_assert(test_category<has_virtual_destructor, EnumType>(false), "");
static_assert(test_category<has_virtual_destructor, ClassType>(false), "");
static_assert(test_category<has_virtual_destructor, DerivedType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_abstract<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_abstract<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,39 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_abstract;
using namespace __gnu_test;
// Positive tests.
static_assert(test_category<is_abstract, AbstractClass>(true), "");
// Negative tests.
static_assert(test_category<is_abstract, void>(false), "");
static_assert(test_category<is_abstract, int (int)>(false), "");
static_assert(test_category<is_abstract, int&>(false), "");
// Sanity check.
static_assert(test_category<is_abstract, ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_arithmetic<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_arithmetic<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,51 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_arithmetic;
using namespace __gnu_test;
static_assert(test_category<is_arithmetic, void>(false), "");
static_assert(test_category<is_arithmetic, char>(true), "");
static_assert(test_category<is_arithmetic, signed char>(true), "");
static_assert(test_category<is_arithmetic, unsigned char>(true), "");
#ifdef _GLIBCXX_USE_WCHAR_T
static_assert(test_category<is_arithmetic, wchar_t>(true), "");
#endif
static_assert(test_category<is_arithmetic, short>(true), "");
static_assert(test_category<is_arithmetic, unsigned short>(true), "");
static_assert(test_category<is_arithmetic, int>(true), "");
static_assert(test_category<is_arithmetic, unsigned int>(true), "");
static_assert(test_category<is_arithmetic, long>(true), "");
static_assert(test_category<is_arithmetic, unsigned long>(true), "");
static_assert(test_category<is_arithmetic, long long>(true), "");
static_assert(test_category<is_arithmetic, unsigned long long>(true), "");
static_assert(test_category<is_arithmetic, float>(true), "");
static_assert(test_category<is_arithmetic, double>(true), "");
static_assert(test_category<is_arithmetic, long double>(true), "");
// Sanity check.
static_assert(test_category<is_arithmetic, ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_array<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_array<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,44 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_array;
using namespace __gnu_test;
static_assert(test_category<is_array, int[2]>(true), "");
static_assert(test_category<is_array, int[]>(true), "");
static_assert(test_category<is_array, int[2][3]>(true), "");
static_assert(test_category<is_array, int[][3]>(true), "");
static_assert(test_category<is_array, float*[2]>(true), "");
static_assert(test_category<is_array, float*[]>(true), "");
static_assert(test_category<is_array, float*[2][3]>(true), "");
static_assert(test_category<is_array, float*[][3]>(true), "");
static_assert(test_category<is_array, ClassType[2]>(true), "");
static_assert(test_category<is_array, ClassType[]>(true), "");
static_assert(test_category<is_array, ClassType[2][3]>(true), "");
static_assert(test_category<is_array, ClassType[][3]>(true), "");
// Sanity check.
static_assert(test_category<is_array, ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_base_of<test_type, test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_base_of<int, int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,89 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
class HiddenCons
{
HiddenCons();
HiddenCons(const HiddenCons&);
};
class DerivedHiddenCons
: private HiddenCons
{
DerivedHiddenCons();
DerivedHiddenCons(const DerivedHiddenCons&);
};
class MultiDerivedHiddenCons
: private HiddenCons, private __gnu_test::ClassType
{
MultiDerivedHiddenCons();
MultiDerivedHiddenCons(const MultiDerivedHiddenCons&);
};
void test01()
{
using std::is_base_of;
using namespace __gnu_test;
// Positive tests.
static_assert(test_relationship<is_base_of, AbstractClass,
AbstractClass>(true), "");
static_assert(test_relationship<is_base_of, ClassType,
DerivedType>(true), "");
static_assert(test_relationship<is_base_of, ClassType,
const DerivedType>(true), "");
static_assert(test_relationship<is_base_of, volatile ClassType,
volatile DerivedType>(true), "");
static_assert(test_relationship<is_base_of, PolymorphicClass,
DerivedPolymorphic>(true), "");
static_assert(test_relationship<is_base_of, HiddenCons,
DerivedHiddenCons>(true), "");
static_assert(test_relationship<is_base_of, HiddenCons,
MultiDerivedHiddenCons>(true), "");
static_assert(test_relationship<is_base_of, ClassType,
MultiDerivedHiddenCons>(true), "");
// Negative tests.
static_assert(test_relationship<is_base_of, int, int>(false), "");
static_assert(test_relationship<is_base_of, EnumType, EnumType>(false), "");
static_assert(test_relationship<is_base_of, UnionType, UnionType>(false), "");
static_assert(test_relationship<is_base_of, int, const int>(false), "");
static_assert(test_relationship<is_base_of, volatile UnionType,
UnionType>(false), "");
static_assert(test_relationship<is_base_of, int&, ClassType>(false), "");
static_assert(test_relationship<is_base_of, AbstractClass,
ClassType>(false), "");
static_assert(test_relationship<is_base_of, ClassType,
AbstractClass>(false), "");
static_assert(test_relationship<is_base_of, DerivedType,
ClassType>(false), "");
static_assert(test_relationship<is_base_of, DerivedPolymorphic,
PolymorphicClass>(false), "");
static_assert(test_relationship<is_base_of, DerivedHiddenCons,
HiddenCons>(false), "");
static_assert(test_relationship<is_base_of, MultiDerivedHiddenCons,
HiddenCons>(false), "");
static_assert(test_relationship<is_base_of, MultiDerivedHiddenCons,
ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_class<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_class<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,51 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_class;
using namespace __gnu_test;
// Positive tests.
static_assert(test_category<is_class, ClassType>(true), "");
static_assert(test_category<is_class, DerivedType>(true), "");
static_assert(test_category<is_class, ConvType>(true), "");
static_assert(test_category<is_class, AbstractClass>(true), "");
static_assert(test_category<is_class, PolymorphicClass>(true), "");
static_assert(test_category<is_class, DerivedPolymorphic>(true), "");
// Negative tests.
static_assert(test_category<is_class, UnionType>(false), "");
static_assert(test_category<is_class, void>(false), "");
static_assert(test_category<is_class, int>(false), "");
static_assert(test_category<is_class, float>(false), "");
static_assert(test_category<is_class, int[2]>(false), "");
static_assert(test_category<is_class, int*>(false), "");
static_assert(test_category<is_class, int(*)(int)>(false), "");
static_assert(test_category<is_class, float&>(false), "");
static_assert(test_category<is_class, float(&)(float)>(false), "");
static_assert(test_category<is_class, int (ClassType::*)>(false), "");
static_assert(test_category<is_class, int (ClassType::*) (int)>(false), "");
static_assert(test_category<is_class, int (int)>(false), "");
static_assert(test_category<is_class, EnumType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_const<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_const<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,40 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_const;
using namespace __gnu_test;
// Positive tests.
static_assert(test_property<is_const, const int>(true), "");
static_assert(test_property<is_const, const volatile int>(true), "");
static_assert(test_property<is_const, cClassType>(true), "");
static_assert(test_property<is_const, cvClassType>(true), "");
// Negative tests.
static_assert(test_property<is_const, int>(false), "");
static_assert(test_property<is_const, volatile int>(false), "");
static_assert(test_property<is_const, ClassType>(false), "");
static_assert(test_property<is_const, vClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_empty<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_empty<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,66 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
class EmptyClassOne
{ typedef int type; };
class EmptyClassTwo
{ static int data; };
class EmptyClassThree
{ int f(); };
class NonEmptyClassOne
{ int data; };
class NonEmptyClassTwo
{
virtual int f();
virtual ~NonEmptyClassTwo();
};
void test01()
{
using std::is_empty;
using namespace __gnu_test;
// Positive tests.
static_assert(test_category<is_empty, ClassType>(true), "");
static_assert(test_category<is_empty, EmptyClassOne>(true), "");
static_assert(test_category<is_empty, EmptyClassTwo>(true), "");
static_assert(test_category<is_empty, EmptyClassThree>(true), "");
// Negative tests.
static_assert(test_category<is_empty, void>(false), "");
static_assert(test_category<is_empty, float>(false), "");
static_assert(test_category<is_empty, int[4]>(false), "");
static_assert(test_category<is_empty, int*>(false), "");
static_assert(test_category<is_empty, int&>(false), "");
static_assert(test_category<is_empty, int (ClassType::*)>(false), "");
static_assert(test_category<is_empty, EnumType>(false), "");
static_assert(test_category<is_empty, int (int)>(false), "");
static_assert(test_category<is_empty, AbstractClass>(false), "");
static_assert(test_category<is_empty, NonEmptyClassOne>(false), "");
static_assert(test_category<is_empty, NonEmptyClassTwo>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_enum<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_enum<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,49 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_enum;
using namespace __gnu_test;
// Positive tests.
static_assert(test_category<is_enum, EnumType>(true), "");
// Negative tests.
static_assert(test_category<is_enum, void>(false), "");
static_assert(test_category<is_enum, int>(false), "");
static_assert(test_category<is_enum, float>(false), "");
static_assert(test_category<is_enum, int[2]>(false), "");
static_assert(test_category<is_enum, int*>(false), "");
static_assert(test_category<is_enum, int(*)(int)>(false), "");
static_assert(test_category<is_enum, float&>(false), "");
static_assert(test_category<is_enum, float(&)(float)>(false), "");
static_assert(test_category<is_enum, int (ClassType::*)>(false), "");
static_assert(test_category<is_enum, int (ClassType::*) (int)>(false), "");
static_assert(test_category<is_enum, int (int)>(false), "");
static_assert(test_category<is_enum, ConvType>(false), "");
// Sanity check.
static_assert(test_category<is_enum, ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_pointer<test_type>;
}

View File

@ -0,0 +1,35 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_pointer;
using namespace __gnu_test;
static_assert(test_category<is_pointer, int*>(true), "");
static_assert(test_category<is_pointer, ClassType*>(true), "");
static_assert(test_category<is_pointer, int(*)(int)>(true), "");
// Sanity check.
static_assert(test_category<is_pointer, ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_polymorphic<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_polymorphic<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,46 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <iostream>
#include <testsuite_tr1.h>
void test01()
{
using std::is_polymorphic;
using namespace __gnu_test;
// Positive tests.
static_assert(test_category<is_polymorphic, PolymorphicClass>(true), "");
static_assert(test_category<is_polymorphic, DerivedPolymorphic>(true), "");
static_assert(test_category<is_polymorphic, AbstractClass>(true), "");
static_assert(test_category<is_polymorphic,
VirtualDestructorClass>(true), "");
static_assert(test_category<is_polymorphic, std::iostream>(true), "");
static_assert(test_category<is_polymorphic, std::streambuf>(true), "");
// Negative tests.
static_assert(test_category<is_polymorphic, void>(false), "");
static_assert(test_category<is_polymorphic, int (int)>(false), "");
static_assert(test_category<is_polymorphic, int&>(false), "");
static_assert(test_category<is_polymorphic, EnumType>(false), "");
static_assert(test_category<is_polymorphic, ClassType>(false), "");
static_assert(test_category<is_polymorphic, DerivedType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_same<test_type, test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_same<int, int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,40 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_same;
using namespace __gnu_test;
// Positive tests.
static_assert(test_relationship<is_same, int, int>(true), "");
static_assert(test_relationship<is_same, const int, const int>(true), "");
static_assert(test_relationship<is_same, int&, int&>(true), "");
static_assert(test_relationship<is_same, ClassType, ClassType>(true), "");
// Negative tests.
static_assert(test_relationship<is_same, void, int>(false), "");
static_assert(test_relationship<is_same, int, const int>(false), "");
static_assert(test_relationship<is_same, int, int&>(false), "");
static_assert(test_relationship<is_same, int, ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_union<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_union<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,51 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_union;
using namespace __gnu_test;
// Positive tests.
static_assert(test_category<is_union, UnionType>(true), "");
// Negative tests.
static_assert(test_category<is_union, ClassType>(false), "");
static_assert(test_category<is_union, DerivedType>(false), "");
static_assert(test_category<is_union, ConvType>(false), "");
static_assert(test_category<is_union, AbstractClass>(false), "");
static_assert(test_category<is_union, PolymorphicClass>(false), "");
static_assert(test_category<is_union, DerivedPolymorphic>(false), "");
static_assert(test_category<is_union, void>(false), "");
static_assert(test_category<is_union, int>(false), "");
static_assert(test_category<is_union, float>(false), "");
static_assert(test_category<is_union, int[2]>(false), "");
static_assert(test_category<is_union, int*>(false), "");
static_assert(test_category<is_union, int(*)(int)>(false), "");
static_assert(test_category<is_union, float&>(false), "");
static_assert(test_category<is_union, float(&)(float)>(false), "");
static_assert(test_category<is_union, int (ClassType::*)>(false), "");
static_assert(test_category<is_union, int (ClassType::*) (int)>(false), "");
static_assert(test_category<is_union, int (int)>(false), "");
static_assert(test_category<is_union, EnumType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_void<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_void<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,51 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_void;
using namespace __gnu_test;
static_assert(test_category<is_void, void>(true), "");
static_assert(test_category<is_void, char>(false), "");
static_assert(test_category<is_void, signed char>(false), "");
static_assert(test_category<is_void, unsigned char>(false), "");
#ifdef _GLIBCXX_USE_WCHAR_T
static_assert(test_category<is_void, wchar_t>(false), "");
#endif
static_assert(test_category<is_void, short>(false), "");
static_assert(test_category<is_void, unsigned short>(false), "");
static_assert(test_category<is_void, int>(false), "");
static_assert(test_category<is_void, unsigned int>(false), "");
static_assert(test_category<is_void, long>(false), "");
static_assert(test_category<is_void, unsigned long>(false), "");
static_assert(test_category<is_void, long long>(false), "");
static_assert(test_category<is_void, unsigned long long>(false), "");
static_assert(test_category<is_void, float>(false), "");
static_assert(test_category<is_void, double>(false), "");
static_assert(test_category<is_void, long double>(false), "");
// Sanity check.
static_assert(test_category<is_void, ClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_volatile<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_volatile<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,40 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::is_volatile;
using namespace __gnu_test;
// Positive tests.
static_assert(test_property<is_volatile, volatile int>(true), "");
static_assert(test_property<is_volatile, const volatile int>(true), "");
static_assert(test_property<is_volatile, vClassType>(true), "");
static_assert(test_property<is_volatile, cvClassType>(true), "");
// Negative tests.
static_assert(test_property<is_volatile, int>(false), "");
static_assert(test_property<is_volatile, const int>(false), "");
static_assert(test_property<is_volatile, ClassType>(false), "");
static_assert(test_property<is_volatile, cClassType>(false), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct rank<test_type>;
}

View File

@ -0,0 +1,34 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::rank<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}

View File

@ -0,0 +1,37 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::rank;
using namespace __gnu_test;
static_assert(test_property<rank, int>(0), "");
static_assert(test_property<rank, int[2]>(1), "");
static_assert(test_property<rank, int[][4]>(2), "");
static_assert(test_property<rank, int[2][2][4][4][6][6]>(6), "");
static_assert(test_property<rank, ClassType>(0), "");
static_assert(test_property<rank, ClassType[2]>(1), "");
static_assert(test_property<rank, ClassType[][4]>(2), "");
static_assert(test_property<rank, ClassType[2][2][4][4][6][6]>(6), "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct remove_all_extents<test_type>;
}

View File

@ -0,0 +1,46 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::remove_all_extents;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<remove_all_extents<int>::type, int>::value, "");
static_assert(is_same<remove_all_extents<int[2]>::type, int>::value, "");
static_assert(is_same<remove_all_extents<int[2][3]>::type, int>::value, "");
static_assert(is_same<remove_all_extents<int[][3]>::type, int>::value, "");
static_assert(is_same<remove_all_extents<const int[2][3]>::type,
const int>::value, "");
static_assert(is_same<remove_all_extents<ClassType>::type,
ClassType>::value, "");
static_assert(is_same<remove_all_extents<ClassType[2]>::type,
ClassType>::value, "");
static_assert(is_same<remove_all_extents<ClassType[2][3]>::type,
ClassType>::value, "");
static_assert(is_same<remove_all_extents<ClassType[][3]>::type,
ClassType>::value, "");
static_assert(is_same<remove_all_extents<const ClassType[2][3]>::type,
const ClassType>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct remove_const<test_type>;
}

View File

@ -0,0 +1,37 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::remove_const;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<remove_const<const volatile int>::type,
volatile int>::value, "");
static_assert(is_same<remove_const<const int*>::type, const int*>::value, "");
static_assert(is_same<remove_const<const volatile ClassType>::type,
volatile ClassType>::value, "");
static_assert(is_same<remove_const<const ClassType*>::type,
const ClassType*>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct remove_cv<test_type>;
}

View File

@ -0,0 +1,37 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::remove_cv;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<remove_cv<const volatile int>::type, int>::value, "");
static_assert(is_same<remove_cv<const volatile int*>::type,
const volatile int*>::value, "");
static_assert(is_same<remove_cv<const volatile ClassType>::type,
ClassType>::value, "");
static_assert(is_same<remove_cv<const volatile ClassType*>::type,
const volatile ClassType*>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct remove_extent<test_type>;
}

View File

@ -0,0 +1,45 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::remove_extent;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<remove_extent<int>::type, int>::value, "");
static_assert(is_same<remove_extent<int[2]>::type, int>::value, "");
static_assert(is_same<remove_extent<int[2][3]>::type, int[3]>::value, "");
static_assert(is_same<remove_extent<int[][3]>::type, int[3]>::value, "");
static_assert(is_same<remove_extent<const int[2]>::type,
const int>::value, "");
static_assert(is_same<remove_extent<ClassType>::type, ClassType>::value, "");
static_assert(is_same<remove_extent<ClassType[2]>::type,
ClassType>::value, "");
static_assert(is_same<remove_extent<ClassType[2][3]>::type,
ClassType[3]>::value, "");
static_assert(is_same<remove_extent<ClassType[][3]>::type,
ClassType[3]>::value, "");
static_assert(is_same<remove_extent<const ClassType[2]>::type,
const ClassType>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct remove_pointer<test_type>;
}

View File

@ -0,0 +1,38 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::remove_pointer;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<remove_pointer<int*>::type, int>::value, "");
static_assert(is_same<remove_pointer<int>::type, int>::value, "");
static_assert(is_same<remove_pointer<const int*>::type,
const int>::value, "");
static_assert(is_same<remove_pointer<int**>::type, int*>::value, "");
static_assert(is_same<remove_pointer<ClassType*>::type,
ClassType>::value, "");
static_assert(is_same<remove_pointer<ClassType>::type, ClassType>::value, "");
}

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct remove_volatile<test_type>;
}

View File

@ -0,0 +1,38 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_tr1.h>
void test01()
{
using std::remove_volatile;
using std::is_same;
using namespace __gnu_test;
static_assert(is_same<remove_volatile<const volatile int>::type,
const int>::value, "");
static_assert(is_same<remove_volatile<volatile int*>::type,
volatile int*>::value, "");
static_assert(is_same<remove_volatile<const volatile ClassType>::type,
const ClassType>::value, "");
static_assert(is_same<remove_volatile<volatile ClassType*>::type,
volatile ClassType*>::value, "");
}