summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-24 20:33:56 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-24 20:33:56 +0000
commit13ebd0155435baacf243a00611169e71ea6225c8 (patch)
treed217ce89eec0b444475b125e962085a761a003cd /libstdc++-v3/testsuite
parent97fec57be0b2e44ff3a182c02ab3470b7cf0fb4d (diff)
downloadgcc-13ebd0155435baacf243a00611169e71ea6225c8.tar.gz
2004-12-24 Paolo Carlini <pcarlini@suse.de>
* include/tr1/type_traits: Implement is_member_object_pointer, is_member_function_pointer. N.B. Due to c++/19076, the latter doesn't really work at the moment (a rather ugly work around will be provided in case the front-end bug doesn't get fixed soon); generalize and extend the _DEFINE_SPEC macros. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_member_pointer/is_member_pointer.cc: New. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_member_pointer/typedefs.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_member_function_pointer/is_member_function_pointer.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_member_function_pointer/typedefs.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_member_object_pointer/is_member_object_pointer.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_member_object_pointer/typedefs.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92593 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc56
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc62
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc59
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc36
6 files changed, 285 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc
new file mode 100644
index 00000000000..918417e4ed2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc
@@ -0,0 +1,56 @@
+// 2004-12-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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_member_pointer;
+ using namespace __gnu_test;
+
+ VERIFY( (test_category<is_member_pointer, int (ClassType::*)>(true)) );
+ VERIFY( (test_category<is_member_pointer, const int (ClassType::*)>(true)) );
+ VERIFY( (test_category<is_member_pointer, ClassType (ClassType::*)>(true)) );
+
+ // Temporarily disabled because of c++/19076 :-(
+
+ //VERIFY( (test_category<is_member_pointer,
+ // int (ClassType::*) (int)>(true)) );
+ //VERIFY( (test_category<is_member_pointer,
+ // int (ClassType::*) (int) const>(true)) );
+ //VERIFY( (test_category<is_member_function_pointer,
+ // ClassType (ClassType::*) (ClassType)>(true)) );
+ //VERIFY( (test_category<is_member_pointer,
+ // float (ClassType::*) (int, float, int[], int&)>(true)) );
+
+ // Sanity check.
+ VERIFY( (test_category<is_member_pointer, ClassType>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc
new file mode 100644
index 00000000000..90cb87433a2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc
@@ -0,0 +1,36 @@
+// 2004-12-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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_member_pointer<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/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc
new file mode 100644
index 00000000000..9652e1943e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc
@@ -0,0 +1,62 @@
+// 2004-12-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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_member_function_pointer;
+ using namespace __gnu_test;
+
+ // Positive tests.
+
+ // Temporarily disabled because of c++/19076 :-(
+
+ //VERIFY( (test_category<is_member_function_pointer,
+ // int (ClassType::*) (int)>(true)) );
+ //VERIFY( (test_category<is_member_function_pointer,
+ // int (ClassType::*) (int) const>(true)) );
+ //VERIFY( (test_category<is_member_function_pointer,
+ // ClassType (ClassType::*) (ClassType)>(true)) );
+ //VERIFY( (test_category<is_member_function_pointer,
+ // float (ClassType::*) (int, float, int[], int&)>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_category<is_member_function_pointer,
+ int (ClassType::*)>(false)) );
+ VERIFY( (test_category<is_member_function_pointer,
+ const int (ClassType::*)>(false)) );
+ VERIFY( (test_category<is_member_function_pointer,
+ ClassType (ClassType::*)>(false)) );
+
+ // Sanity check.
+ VERIFY( (test_category<is_member_function_pointer, ClassType>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc
new file mode 100644
index 00000000000..89112e3608f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc
@@ -0,0 +1,36 @@
+// 2004-12-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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_member_function_pointer<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/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc
new file mode 100644
index 00000000000..986eee1173c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc
@@ -0,0 +1,59 @@
+// 2004-12-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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_member_object_pointer;
+ using namespace __gnu_test;
+
+ // Positive tests.
+ VERIFY( (test_category<is_member_object_pointer,
+ int (ClassType::*)>(true)) );
+ VERIFY( (test_category<is_member_object_pointer,
+ const int (ClassType::*)>(true)) );
+ VERIFY( (test_category<is_member_object_pointer,
+ ClassType (ClassType::*)>(true)) );
+
+ // Negative tests.
+ VERIFY( (test_category<is_member_object_pointer,
+ int (ClassType::*) (int)>(false)) );
+ VERIFY( (test_category<is_member_object_pointer,
+ int (ClassType::*) (int) const>(false)) );
+ VERIFY( (test_category<is_member_object_pointer,
+ ClassType (ClassType::*) (ClassType)>(false)) );
+ VERIFY( (test_category<is_member_object_pointer,
+ float (ClassType::*) (int, float, int[], int&)>(false)) );
+
+ // Sanity check.
+ VERIFY( (test_category<is_member_object_pointer, ClassType>(false)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc
new file mode 100644
index 00000000000..414c2ea1624
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc
@@ -0,0 +1,36 @@
+// 2004-12-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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_member_object_pointer<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;
+}