diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-12-08 09:44:48 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-12-08 09:44:48 +0000 |
commit | ae29d0253f8333b228e24c6202f567ee9dca8da9 (patch) | |
tree | ac1f3d73fcae0e398e3267427d09fca9f0e3dbaa | |
parent | 7cf0b2a659a78b8e463a5bb776b8fc72b7f295df (diff) | |
download | gcc-ae29d0253f8333b228e24c6202f567ee9dca8da9.tar.gz |
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
74 files changed, 2778 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e437e5eecbc..a814fd5855e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -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, diff --git a/libstdc++-v3/testsuite/20_util/add_const/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/add_const/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..815008a396a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_const/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/add_const/value.cc b/libstdc++-v3/testsuite/20_util/add_const/value.cc new file mode 100644 index 00000000000..d300e4c8908 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_const/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/add_cv/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/add_cv/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1eaeeb75fb2 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_cv/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/add_cv/value.cc b/libstdc++-v3/testsuite/20_util/add_cv/value.cc new file mode 100644 index 00000000000..c36f13c4849 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_cv/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/add_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/add_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..68a8cafce4a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_pointer/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/add_pointer/value.cc b/libstdc++-v3/testsuite/20_util/add_pointer/value.cc new file mode 100644 index 00000000000..de43d6bc269 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_pointer/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/add_volatile/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/add_volatile/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..cfc657ca5db --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_volatile/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/add_volatile/value.cc b/libstdc++-v3/testsuite/20_util/add_volatile/value.cc new file mode 100644 index 00000000000..b78b14eaa81 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/add_volatile/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/alignment_of/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/alignment_of/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..0cee459a4cb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/alignment_of/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/alignment_of/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/alignment_of/requirements/typedefs.cc new file mode 100644 index 00000000000..e47147191c1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/alignment_of/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/alignment_of/value.cc b/libstdc++-v3/testsuite/20_util/alignment_of/value.cc new file mode 100644 index 00000000000..29b8719daa8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/alignment_of/value.cc @@ -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)), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/extent/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/extent/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..dddbfbe7f8b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/extent/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/extent/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/extent/requirements/typedefs.cc new file mode 100644 index 00000000000..c59c66b876e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/extent/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/extent/value.cc b/libstdc++-v3/testsuite/20_util/extent/value.cc new file mode 100644 index 00000000000..1f1c0dd21ff --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/extent/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..af5871fe8bf --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/typedefs.cc new file mode 100644 index 00000000000..1e4bd32746b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/has_virtual_destructor/value.cc b/libstdc++-v3/testsuite/20_util/has_virtual_destructor/value.cc new file mode 100644 index 00000000000..7ab6a5d5b3a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_virtual_destructor/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_abstract/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_abstract/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..5a7a766e895 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_abstract/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_abstract/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_abstract/requirements/typedefs.cc new file mode 100644 index 00000000000..3c753240cad --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_abstract/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_abstract/value.cc b/libstdc++-v3/testsuite/20_util/is_abstract/value.cc new file mode 100644 index 00000000000..8f01419fb89 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_abstract/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_arithmetic/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_arithmetic/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..c9642c89444 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_arithmetic/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_arithmetic/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_arithmetic/requirements/typedefs.cc new file mode 100644 index 00000000000..308669452ea --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_arithmetic/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_arithmetic/value.cc b/libstdc++-v3/testsuite/20_util/is_arithmetic/value.cc new file mode 100644 index 00000000000..5150882040a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_arithmetic/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_array/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_array/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1ae681fe4fa --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_array/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_array/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_array/requirements/typedefs.cc new file mode 100644 index 00000000000..b9fcb85bfc0 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_array/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_array/value.cc b/libstdc++-v3/testsuite/20_util/is_array/value.cc new file mode 100644 index 00000000000..a8e336d3773 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_array/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_base_of/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_base_of/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1564e0aa559 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_base_of/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_base_of/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_base_of/requirements/typedefs.cc new file mode 100644 index 00000000000..d39b007ed94 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_base_of/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_base_of/value.cc b/libstdc++-v3/testsuite/20_util/is_base_of/value.cc new file mode 100644 index 00000000000..cacee4c5dee --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_base_of/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_class/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_class/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..884f4872917 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_class/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_class/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_class/requirements/typedefs.cc new file mode 100644 index 00000000000..1cd8d9958cd --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_class/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_class/value.cc b/libstdc++-v3/testsuite/20_util/is_class/value.cc new file mode 100644 index 00000000000..d3a4add7910 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_class/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_const/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_const/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..c5ee5425f61 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_const/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_const/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_const/requirements/typedefs.cc new file mode 100644 index 00000000000..6a5d3bf01ec --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_const/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_const/value.cc b/libstdc++-v3/testsuite/20_util/is_const/value.cc new file mode 100644 index 00000000000..82f18e0a65a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_const/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_empty/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_empty/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..75aff62eac5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_empty/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_empty/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_empty/requirements/typedefs.cc new file mode 100644 index 00000000000..d7102ebe864 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_empty/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_empty/value.cc b/libstdc++-v3/testsuite/20_util/is_empty/value.cc new file mode 100644 index 00000000000..3334bd527fd --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_empty/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_enum/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_enum/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..f467bc263b7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_enum/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_enum/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_enum/requirements/typedefs.cc new file mode 100644 index 00000000000..6c18666657f --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_enum/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_enum/value.cc b/libstdc++-v3/testsuite/20_util/is_enum/value.cc new file mode 100644 index 00000000000..c418f7640d1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_enum/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..109b0381523 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_pointer/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_pointer/value.cc b/libstdc++-v3/testsuite/20_util/is_pointer/value.cc new file mode 100644 index 00000000000..f2115183af8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_pointer/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_polymorphic/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_polymorphic/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..fd214359429 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_polymorphic/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_polymorphic/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_polymorphic/requirements/typedefs.cc new file mode 100644 index 00000000000..1a35c52d1be --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_polymorphic/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_polymorphic/value.cc b/libstdc++-v3/testsuite/20_util/is_polymorphic/value.cc new file mode 100644 index 00000000000..9a7a5e366c7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_polymorphic/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_same/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_same/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..5f46875e0cd --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_same/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_same/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_same/requirements/typedefs.cc new file mode 100644 index 00000000000..b035cf8900c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_same/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_same/value.cc b/libstdc++-v3/testsuite/20_util/is_same/value.cc new file mode 100644 index 00000000000..3a46f292b82 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_same/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_union/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_union/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1786bf7bceb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_union/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_union/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_union/requirements/typedefs.cc new file mode 100644 index 00000000000..3b574c4f283 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_union/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_union/value.cc b/libstdc++-v3/testsuite/20_util/is_union/value.cc new file mode 100644 index 00000000000..b8a3835e511 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_union/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_void/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_void/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..7823bb29dc8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_void/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_void/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_void/requirements/typedefs.cc new file mode 100644 index 00000000000..6242d5e8a81 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_void/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_void/value.cc b/libstdc++-v3/testsuite/20_util/is_void/value.cc new file mode 100644 index 00000000000..d8ea2511d70 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_void/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_volatile/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_volatile/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..94c4784bfa3 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_volatile/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_volatile/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_volatile/requirements/typedefs.cc new file mode 100644 index 00000000000..45abc85b4a9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_volatile/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_volatile/value.cc b/libstdc++-v3/testsuite/20_util/is_volatile/value.cc new file mode 100644 index 00000000000..6f7a8d343c4 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_volatile/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/rank/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/rank/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..6c895c08411 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/rank/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/rank/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/rank/requirements/typedefs.cc new file mode 100644 index 00000000000..e1015bd1b61 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/rank/requirements/typedefs.cc @@ -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; +} diff --git a/libstdc++-v3/testsuite/20_util/rank/value.cc b/libstdc++-v3/testsuite/20_util/rank/value.cc new file mode 100644 index 00000000000..de27bb87575 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/rank/value.cc @@ -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), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/remove_all_extents/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/remove_all_extents/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..7a01f47e0f6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_all_extents/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/remove_all_extents/value.cc b/libstdc++-v3/testsuite/20_util/remove_all_extents/value.cc new file mode 100644 index 00000000000..6de63856eac --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_all_extents/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/remove_const/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/remove_const/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..5974a5634b9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_const/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/remove_const/value.cc b/libstdc++-v3/testsuite/20_util/remove_const/value.cc new file mode 100644 index 00000000000..dfc8edf8a36 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_const/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/remove_cv/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/remove_cv/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..3ef3f1fbdc9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_cv/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/remove_cv/value.cc b/libstdc++-v3/testsuite/20_util/remove_cv/value.cc new file mode 100644 index 00000000000..b1c59b8d748 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_cv/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/remove_extent/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/remove_extent/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..0097100a139 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_extent/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/remove_extent/value.cc b/libstdc++-v3/testsuite/20_util/remove_extent/value.cc new file mode 100644 index 00000000000..ddbbd6af02d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_extent/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/remove_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/remove_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1cac9852645 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_pointer/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/remove_pointer/value.cc b/libstdc++-v3/testsuite/20_util/remove_pointer/value.cc new file mode 100644 index 00000000000..a032811835e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_pointer/value.cc @@ -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, ""); +} diff --git a/libstdc++-v3/testsuite/20_util/remove_volatile/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/remove_volatile/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1f39beca364 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_volatile/requirements/explicit_instantiation.cc @@ -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>; +} diff --git a/libstdc++-v3/testsuite/20_util/remove_volatile/value.cc b/libstdc++-v3/testsuite/20_util/remove_volatile/value.cc new file mode 100644 index 00000000000..9a582968334 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/remove_volatile/value.cc @@ -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, ""); +} |