summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-09 17:07:37 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-09 17:07:37 +0000
commit6be2333a3345cc46e745db7280c1bfc2c1326018 (patch)
tree0c08230ec70b696c8b3ac9ea29297b04a72bf12c /libstdc++-v3/testsuite
parentd9745cea0edd0db7c11861860449a97e00dcb575 (diff)
downloadgcc-6be2333a3345cc46e745db7280c1bfc2c1326018.tar.gz
2007-04-09 Paolo Carlini <pcarlini@suse.de>
* include/tr1/type_traits_fwd.h (__is_union_or_class): Remove. * include/tr1/type_traits (struct __in_array, struct __is_union_or_class, struct __is_union_or_class_helper, struct __is_empty_helper, struct __is_polymorphic_helper): Remove. (struct is_enum): Use __is_enum. (struct is_union): Use __is_union. (struct is_class): Use __is_class. (struct is_function): Adjust. (struct is_empty): Use __is_empty. (struct is_polymorphic): Use __is_polymorphic. (struct is_abstract): Use __is_abstract. (struct has_virtual_destructor): Use __has_virtual_destructor. (struct __is_base_of_helper): Use __is_base_of. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_union_or_class/typedefs.cc: Remove. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_union_or_class/is_union_or_class.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_class/typedefs.cc: New. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_class/is_class.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_union/typedefs.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_union/is_union.cc: Likewise. * testsuite/tr1/4_metaprogramming/type_properties/ has_virtual_destructor/typedefs.cc: Likewise. * testsuite/tr1/4_metaprogramming/type_properties/ has_virtual_destructor/has_virtual_destructor.cc: Likewise. * testsuite/util/testsuite_tr1.h (class VirtualDestructorClass): Add. * testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/ is_polymorphic.cc: Add test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123675 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_union_or_class/is_union_or_class.cc62
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_class/is_class.cc61
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_class/typedefs.cc (renamed from libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_union_or_class/typedefs.cc)6
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/is_union.cc61
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/has_virtual_destructor/has_virtual_destructor.cc56
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/has_virtual_destructor/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/is_polymorphic.cc3
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_tr1.h9
9 files changed, 261 insertions, 69 deletions
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_union_or_class/is_union_or_class.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_union_or_class/is_union_or_class.cc
deleted file mode 100644
index 82c727d1ce8..00000000000
--- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_union_or_class/is_union_or_class.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// 2005-02-25 Paolo Carlini <pcarlini@suse.de>
-//
-// Copyright (C) 2005 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-// USA.
-
-// 4.5.2 Composite type traits
-
-#include <tr1/type_traits>
-#include <testsuite_hooks.h>
-#include <testsuite_tr1.h>
-
-void test01()
-{
- bool test __attribute__((unused)) = true;
- using std::tr1::__is_union_or_class;
- using namespace __gnu_test;
-
- // Positive tests.
- VERIFY( (test_category<__is_union_or_class, UnionType>(true)) );
- VERIFY( (test_category<__is_union_or_class, ClassType>(true)) );
- VERIFY( (test_category<__is_union_or_class, DerivedType>(true)) );
- VERIFY( (test_category<__is_union_or_class, ConvType>(true)) );
- VERIFY( (test_category<__is_union_or_class, AbstractClass>(true)) );
- VERIFY( (test_category<__is_union_or_class, PolymorphicClass>(true)) );
- VERIFY( (test_category<__is_union_or_class, DerivedPolymorphic>(true)) );
-
- // Negative tests.
- VERIFY( (test_category<__is_union_or_class, void>(false)) );
- VERIFY( (test_category<__is_union_or_class, int>(false)) );
- VERIFY( (test_category<__is_union_or_class, float>(false)) );
- VERIFY( (test_category<__is_union_or_class, int[2]>(false)) );
- VERIFY( (test_category<__is_union_or_class, int*>(false)) );
- VERIFY( (test_category<__is_union_or_class, int(*)(int)>(false)) );
- VERIFY( (test_category<__is_union_or_class, float&>(false)) );
- VERIFY( (test_category<__is_union_or_class, float(&)(float)>(false)) );
- VERIFY( (test_category<__is_union_or_class, int (ClassType::*)>(false)) );
- VERIFY( (test_category<__is_union_or_class,
- int (ClassType::*) (int)>(false)) );
- VERIFY( (test_category<__is_union_or_class, int (int)>(false)) );
- VERIFY( (test_category<__is_union_or_class, EnumType>(false)) );
-}
-
-int main()
-{
- test01();
- return 0;
-}
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_class/is_class.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_class/is_class.cc
new file mode 100644
index 00000000000..5e88fb5b6d5
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_class/is_class.cc
@@ -0,0 +1,61 @@
+// 2007-04-08 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 4.5.1 Primary type categories
+
+#include <tr1/type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::is_class;
+ using namespace __gnu_test;
+
+ // Positive tests.
+ VERIFY( (test_category<is_class, ClassType>(true)) );
+ VERIFY( (test_category<is_class, DerivedType>(true)) );
+ VERIFY( (test_category<is_class, ConvType>(true)) );
+ VERIFY( (test_category<is_class, AbstractClass>(true)) );
+ VERIFY( (test_category<is_class, PolymorphicClass>(true)) );
+ VERIFY( (test_category<is_class, DerivedPolymorphic>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_category<is_class, UnionType>(false)) );
+ VERIFY( (test_category<is_class, void>(false)) );
+ VERIFY( (test_category<is_class, int>(false)) );
+ VERIFY( (test_category<is_class, float>(false)) );
+ VERIFY( (test_category<is_class, int[2]>(false)) );
+ VERIFY( (test_category<is_class, int*>(false)) );
+ VERIFY( (test_category<is_class, int(*)(int)>(false)) );
+ VERIFY( (test_category<is_class, float&>(false)) );
+ VERIFY( (test_category<is_class, float(&)(float)>(false)) );
+ VERIFY( (test_category<is_class, int (ClassType::*)>(false)) );
+ VERIFY( (test_category<is_class, int (ClassType::*) (int)>(false)) );
+ VERIFY( (test_category<is_class, int (int)>(false)) );
+ VERIFY( (test_category<is_class, EnumType>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_union_or_class/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_class/typedefs.cc
index 65c84e03aab..8ad546ac3b6 100644
--- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_union_or_class/typedefs.cc
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_class/typedefs.cc
@@ -1,6 +1,6 @@
-// 2005-02-25 Paolo Carlini <pcarlini@suse.de>
+// 2007-04-08 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2007 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
@@ -28,7 +28,7 @@
void test01()
{
// Check for required typedefs
- typedef std::tr1::__is_union_or_class<int> test_type;
+ typedef std::tr1::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;
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/is_union.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/is_union.cc
new file mode 100644
index 00000000000..e381f888b27
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/is_union.cc
@@ -0,0 +1,61 @@
+// 2007-04-08 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 4.5.1 Primary type categories
+
+#include <tr1/type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::is_union;
+ using namespace __gnu_test;
+
+ // Positive tests.
+ VERIFY( (test_category<is_union, UnionType>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_category<is_union, ClassType>(false)) );
+ VERIFY( (test_category<is_union, DerivedType>(false)) );
+ VERIFY( (test_category<is_union, ConvType>(false)) );
+ VERIFY( (test_category<is_union, AbstractClass>(false)) );
+ VERIFY( (test_category<is_union, PolymorphicClass>(false)) );
+ VERIFY( (test_category<is_union, DerivedPolymorphic>(false)) );
+ VERIFY( (test_category<is_union, void>(false)) );
+ VERIFY( (test_category<is_union, int>(false)) );
+ VERIFY( (test_category<is_union, float>(false)) );
+ VERIFY( (test_category<is_union, int[2]>(false)) );
+ VERIFY( (test_category<is_union, int*>(false)) );
+ VERIFY( (test_category<is_union, int(*)(int)>(false)) );
+ VERIFY( (test_category<is_union, float&>(false)) );
+ VERIFY( (test_category<is_union, float(&)(float)>(false)) );
+ VERIFY( (test_category<is_union, int (ClassType::*)>(false)) );
+ VERIFY( (test_category<is_union, int (ClassType::*) (int)>(false)) );
+ VERIFY( (test_category<is_union, int (int)>(false)) );
+ VERIFY( (test_category<is_union, EnumType>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/typedefs.cc
new file mode 100644
index 00000000000..9f24c5e9786
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_union/typedefs.cc
@@ -0,0 +1,36 @@
+// 2007-04-08 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+//
+// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
+
+#include <tr1/type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::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/tr1/4_metaprogramming/type_properties/has_virtual_destructor/has_virtual_destructor.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/has_virtual_destructor/has_virtual_destructor.cc
new file mode 100644
index 00000000000..910aeded2d5
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/has_virtual_destructor/has_virtual_destructor.cc
@@ -0,0 +1,56 @@
+// 2007-04-08 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 4.5.3 Type properties
+
+#include <tr1/type_traits>
+#include <iostream>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::has_virtual_destructor;
+ using namespace __gnu_test;
+
+ // Positive tests.
+ VERIFY( (test_category<has_virtual_destructor,
+ VirtualDestructorClass>(true)) );
+ VERIFY( (test_category<has_virtual_destructor, std::iostream>(true)) );
+ VERIFY( (test_category<has_virtual_destructor, std::streambuf>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_category<has_virtual_destructor, PolymorphicClass>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, DerivedPolymorphic>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, AbstractClass>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, void>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, int (int)>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, int&>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, EnumType>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, ClassType>(false)) );
+ VERIFY( (test_category<has_virtual_destructor, DerivedType>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/has_virtual_destructor/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/has_virtual_destructor/typedefs.cc
new file mode 100644
index 00000000000..94d81eafb21
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/has_virtual_destructor/typedefs.cc
@@ -0,0 +1,36 @@
+// 2007-04-08 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+//
+// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
+
+#include <tr1/type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::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/tr1/4_metaprogramming/type_properties/is_polymorphic/is_polymorphic.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/is_polymorphic.cc
index 6a5efa046f9..6dc5c1c2c6d 100644
--- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/is_polymorphic.cc
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/is_polymorphic.cc
@@ -1,6 +1,6 @@
// 2005-03-03 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007 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
@@ -35,6 +35,7 @@ void test01()
VERIFY( (test_category<is_polymorphic, PolymorphicClass>(true)) );
VERIFY( (test_category<is_polymorphic, DerivedPolymorphic>(true)) );
VERIFY( (test_category<is_polymorphic, AbstractClass>(true)) );
+ VERIFY( (test_category<is_polymorphic, VirtualDestructorClass>(true)) );
VERIFY( (test_category<is_polymorphic, std::iostream>(true)) );
VERIFY( (test_category<is_polymorphic, std::streambuf>(true)) );
diff --git a/libstdc++-v3/testsuite/util/testsuite_tr1.h b/libstdc++-v3/testsuite/util/testsuite_tr1.h
index b48f1a36b41..8b630bb23e9 100644
--- a/libstdc++-v3/testsuite/util/testsuite_tr1.h
+++ b/libstdc++-v3/testsuite/util/testsuite_tr1.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// Testing utilities for the tr1 testsuite.
//
-// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007 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
@@ -103,17 +103,20 @@ namespace __gnu_test
class AbstractClass
{
virtual void rotate(int) = 0;
- virtual ~AbstractClass();
};
class PolymorphicClass
{
virtual void rotate(int);
- virtual ~PolymorphicClass();
};
class DerivedPolymorphic : public PolymorphicClass { };
+ class VirtualDestructorClass
+ {
+ virtual ~VirtualDestructorClass();
+ };
+
union UnionType { };
class IncompleteClass;