diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/tr1/4_metaprogramming | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/4_metaprogramming')
159 files changed, 6621 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_const/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_const/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..6f8ba791e --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_const/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct add_const<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_const/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_const/value.cc new file mode 100644 index 000000000..213db8806 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_const/value.cc @@ -0,0 +1,53 @@ +// 2004-12-16 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.7.1 Const-volatile modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::add_const; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<add_const<int>::type, const int>::value) ); + VERIFY( (is_same<add_const<volatile int>::type, const volatile int>::value) ); + VERIFY( (is_same<add_const<int*>::type, int* const>::value) ); + VERIFY( (is_same<add_const<int&>::type, int&>::value) ); + VERIFY( (is_same<add_const<int (int)>::type, int (int)>::value) ); + VERIFY( (is_same<add_const<const int>::type, const int>::value) ); + VERIFY( (is_same<add_const<ClassType>::type, const ClassType>::value) ); + VERIFY( (is_same<add_const<volatile ClassType>::type, + const volatile ClassType>::value) ); + VERIFY( (is_same<add_const<ClassType*>::type, ClassType* const>::value) ); + VERIFY( (is_same<add_const<ClassType&>::type, ClassType&>::value) ); + VERIFY( (is_same<add_const<ClassType (ClassType)>::type, + ClassType (ClassType)>::value) ); + VERIFY( (is_same<add_const<const ClassType>::type, const ClassType>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_cv/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_cv/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..bb2f16bca --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_cv/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct add_cv<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_cv/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_cv/value.cc new file mode 100644 index 000000000..d7c9346c9 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_cv/value.cc @@ -0,0 +1,56 @@ +// 2004-12-16 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.7.1 Const-volatile modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::add_cv; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<add_cv<int>::type, const volatile int>::value) ); + VERIFY( (is_same<add_cv<const int>::type, const volatile int>::value) ); + VERIFY( (is_same<add_cv<int*>::type, int* const volatile>::value) ); + VERIFY( (is_same<add_cv<int&>::type, int&>::value) ); + VERIFY( (is_same<add_cv<int (int)>::type, int (int)>::value) ); + VERIFY( (is_same<add_cv<const volatile int>::type, + const volatile int>::value) ); + VERIFY( (is_same<add_cv<ClassType>::type, const volatile ClassType>::value) ); + VERIFY( (is_same<add_cv<volatile ClassType>::type, + const volatile ClassType>::value) ); + VERIFY( (is_same<add_cv<ClassType*>::type, + ClassType* const volatile>::value) ); + VERIFY( (is_same<add_cv<ClassType&>::type, ClassType&>::value) ); + VERIFY( (is_same<add_cv<ClassType (ClassType)>::type, + ClassType (ClassType)>::value) ); + VERIFY( (is_same<add_cv<const volatile ClassType>::type, + const volatile ClassType>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..3755bd7f9 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct add_pointer<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_pointer/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_pointer/value.cc new file mode 100644 index 000000000..930863636 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_pointer/value.cc @@ -0,0 +1,45 @@ +// 2004-12-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.7.2 Reference modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::add_pointer; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<add_pointer<int>::type, int*>::value) ); + VERIFY( (is_same<add_pointer<int*>::type, int**>::value) ); + VERIFY( (is_same<add_pointer<const int>::type, const int*>::value) ); + VERIFY( (is_same<add_pointer<int&>::type, int*>::value) ); + VERIFY( (is_same<add_pointer<ClassType*>::type, ClassType**>::value) ); + VERIFY( (is_same<add_pointer<ClassType>::type, ClassType*>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_reference/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_reference/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..bd0ca275d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_reference/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct add_reference<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_reference/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_reference/value.cc new file mode 100644 index 000000000..2ff989303 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_reference/value.cc @@ -0,0 +1,48 @@ +// 2004-12-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.7.2 Reference modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::add_reference; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<add_reference<int>::type, int&>::value) ); + VERIFY( (is_same<add_reference<int&>::type, int&>::value) ); + VERIFY( (is_same<add_reference<const int>::type, const int&>::value) ); + VERIFY( (is_same<add_reference<int*>::type, int*&>::value) ); + VERIFY( (is_same<add_reference<ClassType&>::type, ClassType&>::value) ); + VERIFY( (is_same<add_reference<ClassType>::type, ClassType&>::value) ); + + VERIFY( (is_same<add_reference<void>::type, void>::value) ); + VERIFY( (is_same<add_reference<const void>::type, const void>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_volatile/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_volatile/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..f068cb942 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_volatile/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct add_volatile<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_volatile/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_volatile/value.cc new file mode 100644 index 000000000..64e4a7f5a --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/add_volatile/value.cc @@ -0,0 +1,55 @@ +// 2004-12-16 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.7.1 Const-volatile modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::add_volatile; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<add_volatile<int>::type, volatile int>::value) ); + VERIFY( (is_same<add_volatile<const int>::type, const volatile int>::value) ); + VERIFY( (is_same<add_volatile<int*>::type, int* volatile>::value) ); + VERIFY( (is_same<add_volatile<int&>::type, int&>::value) ); + VERIFY( (is_same<add_volatile<int (int)>::type, int (int)>::value) ); + VERIFY( (is_same<add_volatile<volatile int>::type, volatile int>::value) ); + VERIFY( (is_same<add_volatile<ClassType>::type, volatile ClassType>::value) ); + VERIFY( (is_same<add_volatile<const ClassType>::type, + const volatile ClassType>::value) ); + VERIFY( (is_same<add_volatile<ClassType*>::type, + ClassType* volatile>::value) ); + VERIFY( (is_same<add_volatile<ClassType&>::type, ClassType&>::value) ); + VERIFY( (is_same<add_volatile<ClassType (ClassType)>::type, + ClassType (ClassType)>::value) ); + VERIFY( (is_same<add_volatile<volatile ClassType>::type, + volatile ClassType>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/aligned_storage/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/aligned_storage/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..7c7911811 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/aligned_storage/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct aligned_storage<1, alignment_of<test_type>::value>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/aligned_storage/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/aligned_storage/value.cc new file mode 100644 index 000000000..1e933ef99 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/aligned_storage/value.cc @@ -0,0 +1,62 @@ +// 2005-01-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2006, 2007, 2009 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/>. + +// 4.8 Other transformations + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::aligned_storage; + using std::tr1::alignment_of; + using namespace __gnu_test; + + const std::size_t align_c = alignment_of<char>::value; + VERIFY( (sizeof(aligned_storage<4, align_c>::type) >= 4) ); + VERIFY( (__alignof__(aligned_storage<4, align_c>::type) == align_c) ); + + const std::size_t align_s = alignment_of<short>::value; + VERIFY( (sizeof(aligned_storage<1, align_s>::type) >= 1) ); + VERIFY( (__alignof__(aligned_storage<1, align_s>::type) == align_s) ); + + const std::size_t align_i = alignment_of<int>::value; + VERIFY( (sizeof(aligned_storage<7, align_i>::type) >= 7) ); + VERIFY( (__alignof__(aligned_storage<7, align_i>::type) == align_i) ); + + const std::size_t align_d = alignment_of<double>::value; + VERIFY( (sizeof(aligned_storage<2, align_d>::type) >= 2) ); + VERIFY( (__alignof__(aligned_storage<2, align_d>::type) == align_d) ); + + const std::size_t align_ai = alignment_of<int[4]>::value; + VERIFY( (sizeof(aligned_storage<20, align_ai>::type) >= 20) ); + VERIFY( (__alignof__(aligned_storage<20, align_ai>::type) == align_ai) ); + + const std::size_t align_ct = alignment_of<ClassType>::value; + VERIFY( (sizeof(aligned_storage<11, align_ct>::type) >= 11) ); + VERIFY( (__alignof__(aligned_storage<11, align_ct>::type) == align_ct) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..a533645cf --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct alignment_of<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/requirements/typedefs.cc new file mode 100644 index 000000000..b8ed9671c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-01-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/alignment_of/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/value.cc new file mode 100644 index 000000000..234d76f81 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/alignment_of/value.cc @@ -0,0 +1,44 @@ +// 2005-01-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::alignment_of; + using namespace __gnu_test; + + VERIFY( (test_property<alignment_of, char>(__alignof__(char))) ); + VERIFY( (test_property<alignment_of, short>(__alignof__(short))) ); + VERIFY( (test_property<alignment_of, int>(__alignof__(int))) ); + VERIFY( (test_property<alignment_of, double>(__alignof__(double))) ); + VERIFY( (test_property<alignment_of, int[4]>(__alignof__(int[4]))) ); + VERIFY( (test_property<alignment_of, ClassType>(__alignof__(ClassType))) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..03e6520e1 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct extent<test_type, 2>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/requirements/typedefs.cc new file mode 100644 index 000000000..978c8b68a --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/extent/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/value.cc new file mode 100644 index 000000000..d7127aa3c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/extent/value.cc @@ -0,0 +1,56 @@ +// 2004-12-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::extent; + using namespace __gnu_test; + + VERIFY( (test_property<extent, int, 0>(0)) ); + VERIFY( (test_property<extent, int[2], 0>(2)) ); + VERIFY( (test_property<extent, int[2][4], 0>(2)) ); + VERIFY( (test_property<extent, int[][4], 0>(0)) ); + VERIFY( (extent<int, 1>::value == 0) ); + VERIFY( (extent<int[2], 1>::value == 0) ); + VERIFY( (extent<int[2][4], 1>::value == 4) ); + VERIFY( (extent<int[][4], 1>::value == 4) ); + VERIFY( (extent<int[10][4][6][8][12][2], 4>::value == 12) ); + VERIFY( (test_property<extent, ClassType, 0>(0)) ); + VERIFY( (test_property<extent, ClassType[2], 0>(2)) ); + VERIFY( (test_property<extent, ClassType[2][4], 0>(2)) ); + VERIFY( (test_property<extent, ClassType[][4], 0>(0)) ); + VERIFY( (extent<ClassType, 1>::value == 0) ); + VERIFY( (extent<ClassType[2], 1>::value == 0) ); + VERIFY( (extent<ClassType[2][4], 1>::value == 4) ); + VERIFY( (extent<ClassType[][4], 1>::value == 4) ); + VERIFY( (extent<ClassType[10][4][6][8][12][2], 4>::value == 12) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..ee6140a83 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_nothrow_assign<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/requirements/typedefs.cc new file mode 100644 index 000000000..4175eae82 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::has_nothrow_assign<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/has_nothrow_assign/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/value.cc new file mode 100644 index 000000000..478f5e10c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_assign/value.cc @@ -0,0 +1,54 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::has_nothrow_assign; + using namespace __gnu_test; + + VERIFY( (test_category<has_nothrow_assign, void>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int>(true)) ); + VERIFY( (test_category<has_nothrow_assign, float>(true)) ); + VERIFY( (test_category<has_nothrow_assign, EnumType>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int*>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int(*)(int)>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int[2]>(true)) ); + VERIFY( (test_category<has_nothrow_assign, float[][3]>(true)) ); + VERIFY( (test_category<has_nothrow_assign, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int*[3]>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_nothrow_assign, int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_nothrow_assign, + int (ClassType::*[][2][3]) (int)>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..5686cff40 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_nothrow_constructor<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/requirements/typedefs.cc new file mode 100644 index 000000000..85fd577f9 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-29 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::has_nothrow_constructor<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/has_nothrow_constructor/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/value.cc new file mode 100644 index 000000000..d6810d3ac --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_constructor/value.cc @@ -0,0 +1,57 @@ +// 2004-12-29 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::has_nothrow_constructor; + using namespace __gnu_test; + + VERIFY( (test_category<has_nothrow_constructor, void>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, int>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, float>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, EnumType>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, int*>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, int(*)(int)>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, int[2]>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, float[][3]>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, int*[3]>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, + int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, + int (ClassType::*[][2][3]) (int)>(true)) ); + VERIFY( (test_category<has_nothrow_constructor, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..dc07be0d9 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_nothrow_copy<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/requirements/typedefs.cc new file mode 100644 index 000000000..7a05eeb14 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::has_nothrow_copy<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/has_nothrow_copy/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/value.cc new file mode 100644 index 000000000..01a37ec17 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_nothrow_copy/value.cc @@ -0,0 +1,54 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::has_nothrow_copy; + using namespace __gnu_test; + + VERIFY( (test_category<has_nothrow_copy, void>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int>(true)) ); + VERIFY( (test_category<has_nothrow_copy, float>(true)) ); + VERIFY( (test_category<has_nothrow_copy, EnumType>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int*>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int(*)(int)>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int[2]>(true)) ); + VERIFY( (test_category<has_nothrow_copy, float[][3]>(true)) ); + VERIFY( (test_category<has_nothrow_copy, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int*[3]>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_nothrow_copy, int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_nothrow_copy, + int (ClassType::*[][2][3]) (int)>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..d63d9726b --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_trivial_assign<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/requirements/typedefs.cc new file mode 100644 index 000000000..d010f95b0 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::has_trivial_assign<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/has_trivial_assign/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/value.cc new file mode 100644 index 000000000..6804c1e5b --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_assign/value.cc @@ -0,0 +1,54 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::has_trivial_assign; + using namespace __gnu_test; + + VERIFY( (test_category<has_trivial_assign, void>(true)) ); + VERIFY( (test_category<has_trivial_assign, int>(true)) ); + VERIFY( (test_category<has_trivial_assign, float>(true)) ); + VERIFY( (test_category<has_trivial_assign, EnumType>(true)) ); + VERIFY( (test_category<has_trivial_assign, int*>(true)) ); + VERIFY( (test_category<has_trivial_assign, int(*)(int)>(true)) ); + VERIFY( (test_category<has_trivial_assign, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_trivial_assign, int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_trivial_assign, int[2]>(true)) ); + VERIFY( (test_category<has_trivial_assign, float[][3]>(true)) ); + VERIFY( (test_category<has_trivial_assign, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_trivial_assign, int*[3]>(true)) ); + VERIFY( (test_category<has_trivial_assign, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_trivial_assign, int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_trivial_assign, + int (ClassType::*[][2][3]) (int)>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..9d3345864 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_trivial_constructor<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/requirements/typedefs.cc new file mode 100644 index 000000000..ac46b1649 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::has_trivial_constructor<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/has_trivial_constructor/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/value.cc new file mode 100644 index 000000000..e9e8aca83 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_constructor/value.cc @@ -0,0 +1,57 @@ +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::has_trivial_constructor; + using namespace __gnu_test; + + VERIFY( (test_category<has_trivial_constructor, void>(true)) ); + VERIFY( (test_category<has_trivial_constructor, int>(true)) ); + VERIFY( (test_category<has_trivial_constructor, float>(true)) ); + VERIFY( (test_category<has_trivial_constructor, EnumType>(true)) ); + VERIFY( (test_category<has_trivial_constructor, int*>(true)) ); + VERIFY( (test_category<has_trivial_constructor, int(*)(int)>(true)) ); + VERIFY( (test_category<has_trivial_constructor, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_trivial_constructor, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_trivial_constructor, int[2]>(true)) ); + VERIFY( (test_category<has_trivial_constructor, float[][3]>(true)) ); + VERIFY( (test_category<has_trivial_constructor, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_trivial_constructor, int*[3]>(true)) ); + VERIFY( (test_category<has_trivial_constructor, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_trivial_constructor, + int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_trivial_constructor, + int (ClassType::*[][2][3]) (int)>(true)) ); + VERIFY( (test_category<has_trivial_constructor, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..a50bcaa13 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_trivial_copy<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/requirements/typedefs.cc new file mode 100644 index 000000000..6ede2f34d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::has_trivial_copy<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/has_trivial_copy/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/value.cc new file mode 100644 index 000000000..005cefbde --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_copy/value.cc @@ -0,0 +1,54 @@ +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::has_trivial_copy; + using namespace __gnu_test; + + VERIFY( (test_category<has_trivial_copy, void>(true)) ); + VERIFY( (test_category<has_trivial_copy, int>(true)) ); + VERIFY( (test_category<has_trivial_copy, float>(true)) ); + VERIFY( (test_category<has_trivial_copy, EnumType>(true)) ); + VERIFY( (test_category<has_trivial_copy, int*>(true)) ); + VERIFY( (test_category<has_trivial_copy, int(*)(int)>(true)) ); + VERIFY( (test_category<has_trivial_copy, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_trivial_copy, int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_trivial_copy, int[2]>(true)) ); + VERIFY( (test_category<has_trivial_copy, float[][3]>(true)) ); + VERIFY( (test_category<has_trivial_copy, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_trivial_copy, int*[3]>(true)) ); + VERIFY( (test_category<has_trivial_copy, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_trivial_copy, int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_trivial_copy, + int (ClassType::*[][2][3]) (int)>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..27e9fa6ec --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_trivial_destructor<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/requirements/typedefs.cc new file mode 100644 index 000000000..31719e2d0 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::has_trivial_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/has_trivial_destructor/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/value.cc new file mode 100644 index 000000000..c63b05040 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_trivial_destructor/value.cc @@ -0,0 +1,57 @@ +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::has_trivial_destructor; + using namespace __gnu_test; + + VERIFY( (test_category<has_trivial_destructor, void>(true)) ); + VERIFY( (test_category<has_trivial_destructor, int>(true)) ); + VERIFY( (test_category<has_trivial_destructor, float>(true)) ); + VERIFY( (test_category<has_trivial_destructor, EnumType>(true)) ); + VERIFY( (test_category<has_trivial_destructor, int*>(true)) ); + VERIFY( (test_category<has_trivial_destructor, int(*)(int)>(true)) ); + VERIFY( (test_category<has_trivial_destructor, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_trivial_destructor, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_trivial_destructor, int[2]>(true)) ); + VERIFY( (test_category<has_trivial_destructor, float[][3]>(true)) ); + VERIFY( (test_category<has_trivial_destructor, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_trivial_destructor, int*[3]>(true)) ); + VERIFY( (test_category<has_trivial_destructor, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_trivial_destructor, + int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_trivial_destructor, + int (ClassType::*[][2][3]) (int)>(true)) ); + VERIFY( (test_category<has_trivial_destructor, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..bc41fc8e3 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct has_virtual_destructor<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/requirements/typedefs.cc new file mode 100644 index 000000000..478673093 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2007-04-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007, 2009 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 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/has_virtual_destructor/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/value.cc new file mode 100644 index 000000000..dcb490a91 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/has_virtual_destructor/value.cc @@ -0,0 +1,55 @@ +// 2007-04-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007, 2009 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/>. + +// 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/headers/type_traits/synopsis.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/headers/type_traits/synopsis.cc new file mode 100644 index 000000000..5f96f606c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/headers/type_traits/synopsis.cc @@ -0,0 +1,103 @@ +// { dg-do compile } + +// 2007-02-04 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std { +namespace tr1 { + + // [4.3] helper class: + template <class T, T v> struct integral_constant; + typedef integral_constant<bool, true> true_type; + typedef integral_constant<bool, false> false_type; + + // [4.5.1] primary type categories: + template <class T> struct is_void; + template <class T> struct is_integral; + template <class T> struct is_floating_point; + template <class T> struct is_array; + template <class T> struct is_pointer; + template <class T> struct is_reference; + template <class T> struct is_member_object_pointer; + template <class T> struct is_member_function_pointer; + template <class T> struct is_enum; + template <class T> struct is_union; + template <class T> struct is_class; + template <class T> struct is_function; + + // [4.5.2] composite type categories: + template <class T> struct is_arithmetic; + template <class T> struct is_fundamental; + template <class T> struct is_object; + template <class T> struct is_scalar; + template <class T> struct is_compound; + template <class T> struct is_member_pointer; + + // [4.5.3] type properties: + template <class T> struct is_const; + template <class T> struct is_volatile; + template <class T> struct is_pod; + template <class T> struct is_empty; + template <class T> struct is_polymorphic; + template <class T> struct is_abstract; + template <class T> struct has_trivial_constructor; + template <class T> struct has_trivial_copy; + template <class T> struct has_trivial_assign; + template <class T> struct has_trivial_destructor; + template <class T> struct has_nothrow_constructor; + template <class T> struct has_nothrow_copy; + template <class T> struct has_nothrow_assign; + template <class T> struct has_virtual_destructor; + template <class T> struct is_signed; + template <class T> struct is_unsigned; + template <class T> struct alignment_of; + template <class T> struct rank; + template <class T, unsigned I> struct extent; + + // [4.6] type relations: + template <class T, class U> struct is_same; + template <class Base, class Derived> struct is_base_of; + template <class From, class To> struct is_convertible; + + // [4.7.1] const-volatile modifications: + template <class T> struct remove_const; + template <class T> struct remove_volatile; + template <class T> struct remove_cv; + template <class T> struct add_const; + template <class T> struct add_volatile; + template <class T> struct add_cv; + + // [4.7.2] reference modifications: + template <class T> struct remove_reference; + template <class T> struct add_reference; + + // [4.7.3] array modifications: + template <class T> struct remove_extent; + template <class T> struct remove_all_extents; + + // [4.7.4] pointer modifications: + template <class T> struct remove_pointer; + template <class T> struct add_pointer; + + // [4.8] other transformations: + template <std::size_t Len, std::size_t Align> struct aligned_storage; +} // namespace tr1 +} // namespace std diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/headers/type_traits/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/headers/type_traits/types_std_tr1.cc new file mode 100644 index 000000000..0d478f544 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/headers/type_traits/types_std_tr1.cc @@ -0,0 +1,26 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace gnu +{ + using std::tr1::true_type; + using std::tr1::false_type; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/constexpr_data.cc new file mode 100644 index 000000000..52497e1f4 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/constexpr_data.cc @@ -0,0 +1,52 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 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_common_types.h> + +namespace __gnu_test +{ + struct constexpr_member_data + { + template<typename _Ttesttype> + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v __attribute__((unused)) (_Ttesttype::value); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + test.operator()<std::integral_constant<unsigned short, 69>>(); + test.operator()<std::integral_constant<bool, true>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..2b60f5318 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct integral_constant<test_type, -3>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/typedefs.cc new file mode 100644 index 000000000..89fd5c268 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::integral_constant<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/tr1/4_metaprogramming/integral_constant/static_definition.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/static_definition.cc new file mode 100644 index 000000000..c1da4f8ee --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/static_definition.cc @@ -0,0 +1,36 @@ +// 2006-05-07 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2006, 2009 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/>. + +// 4.3 Helper classes + +#include <tr1/type_traits> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + const bool* p = &std::tr1::integral_constant<bool, true>::value; + VERIFY( p ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/true_false_type_typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/true_false_type_typedefs.cc new file mode 100644 index 000000000..94f2fa4aa --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/true_false_type_typedefs.cc @@ -0,0 +1,42 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::true_type true_type; + typedef std::tr1::false_type false_type; + + typedef true_type::value_type true_value_type; + typedef true_type::type true_type; + typedef true_type::type::value_type true_type_value_type; + typedef true_type::type::type true_type_type; + + typedef false_type::value_type false_value_type; + typedef false_type::type false_type; + typedef false_type::type::value_type false_type_value_type; + typedef false_type::type::type false_type_type; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/true_false_value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/true_false_value.cc new file mode 100644 index 000000000..1d5e25d9a --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/integral_constant/true_false_value.cc @@ -0,0 +1,41 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.3 Helper classes + +#include <tr1/type_traits> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::true_type; + using std::tr1::false_type; + + VERIFY( true_type::value == true ); + VERIFY( false_type::value == false ); + VERIFY( true_type::type::value == true ); + VERIFY( false_type::type::value == false ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..3df8b61fa --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_abstract<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/requirements/typedefs.cc new file mode 100644 index 000000000..ff6bc501c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-01-28 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_abstract/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/value.cc new file mode 100644 index 000000000..14c0bbffa --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_abstract/value.cc @@ -0,0 +1,48 @@ +// 2005-01-28 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_abstract; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_abstract, AbstractClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_abstract, void>(false)) ); + VERIFY( (test_category<is_abstract, int (int)>(false)) ); + VERIFY( (test_category<is_abstract, int&>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_abstract, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..c8f9d9639 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_arithmetic<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/requirements/typedefs.cc new file mode 100644 index 000000000..10bbb38eb --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_arithmetic/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/value.cc new file mode 100644 index 000000000..dfed8e40d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_arithmetic/value.cc @@ -0,0 +1,60 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_arithmetic; + using namespace __gnu_test; + + VERIFY( (test_category<is_arithmetic, void>(false)) ); + + VERIFY( (test_category<is_arithmetic, char>(true)) ); + VERIFY( (test_category<is_arithmetic, signed char>(true)) ); + VERIFY( (test_category<is_arithmetic, unsigned char>(true)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_arithmetic, wchar_t>(true)) ); +#endif + VERIFY( (test_category<is_arithmetic, short>(true)) ); + VERIFY( (test_category<is_arithmetic, unsigned short>(true)) ); + VERIFY( (test_category<is_arithmetic, int>(true)) ); + VERIFY( (test_category<is_arithmetic, unsigned int>(true)) ); + VERIFY( (test_category<is_arithmetic, long>(true)) ); + VERIFY( (test_category<is_arithmetic, unsigned long>(true)) ); + VERIFY( (test_category<is_arithmetic, long long>(true)) ); + VERIFY( (test_category<is_arithmetic, unsigned long long>(true)) ); + VERIFY( (test_category<is_arithmetic, float>(true)) ); + VERIFY( (test_category<is_arithmetic, double>(true)) ); + VERIFY( (test_category<is_arithmetic, long double>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_arithmetic, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..c518792b4 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_array<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/requirements/typedefs.cc new file mode 100644 index 000000000..ec08cdd1f --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_array/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/value.cc new file mode 100644 index 000000000..cf3b70ce7 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_array/value.cc @@ -0,0 +1,53 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_array; + using namespace __gnu_test; + + VERIFY( (test_category<is_array, int[2]>(true)) ); + VERIFY( (test_category<is_array, int[]>(true)) ); + VERIFY( (test_category<is_array, int[2][3]>(true)) ); + VERIFY( (test_category<is_array, int[][3]>(true)) ); + VERIFY( (test_category<is_array, float*[2]>(true)) ); + VERIFY( (test_category<is_array, float*[]>(true)) ); + VERIFY( (test_category<is_array, float*[2][3]>(true)) ); + VERIFY( (test_category<is_array, float*[][3]>(true)) ); + VERIFY( (test_category<is_array, ClassType[2]>(true)) ); + VERIFY( (test_category<is_array, ClassType[]>(true)) ); + VERIFY( (test_category<is_array, ClassType[2][3]>(true)) ); + VERIFY( (test_category<is_array, ClassType[][3]>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_array, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..9770f09e6 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_base_of<test_type, test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/requirements/typedefs.cc new file mode 100644 index 000000000..51499d746 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-03-04 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_base_of/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/value.cc new file mode 100644 index 000000000..fa7bc8074 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_base_of/value.cc @@ -0,0 +1,93 @@ +// 2005-03-04 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.6 Relationships between types + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#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() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_base_of; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_relationship<is_base_of, int, int>(true)) ); + VERIFY( (test_relationship<is_base_of, EnumType, EnumType>(true)) ); + VERIFY( (test_relationship<is_base_of, UnionType, UnionType>(true)) ); + VERIFY( (test_relationship<is_base_of, AbstractClass, + AbstractClass>(true)) ); + VERIFY( (test_relationship<is_base_of, ClassType, DerivedType>(true)) ); + VERIFY( (test_relationship<is_base_of, ClassType, const DerivedType>(true)) ); + VERIFY( (test_relationship<is_base_of, volatile ClassType, + volatile DerivedType>(true)) ); + VERIFY( (test_relationship<is_base_of, PolymorphicClass, + DerivedPolymorphic>(true)) ); + VERIFY( (test_relationship<is_base_of, HiddenCons, + DerivedHiddenCons>(true)) ); + VERIFY( (test_relationship<is_base_of, HiddenCons, + MultiDerivedHiddenCons>(true)) ); + VERIFY( (test_relationship<is_base_of, ClassType, + MultiDerivedHiddenCons>(true)) ); + + // Negative tests. + VERIFY( (test_relationship<is_base_of, int, const int>(false)) ); + VERIFY( (test_relationship<is_base_of, volatile UnionType, + UnionType>(false)) ); + VERIFY( (test_relationship<is_base_of, int&, ClassType>(false)) ); + VERIFY( (test_relationship<is_base_of, AbstractClass, ClassType>(false)) ); + VERIFY( (test_relationship<is_base_of, ClassType, AbstractClass>(false)) ); + VERIFY( (test_relationship<is_base_of, DerivedType, ClassType>(false)) ); + VERIFY( (test_relationship<is_base_of, DerivedPolymorphic, + PolymorphicClass>(false)) ); + VERIFY( (test_relationship<is_base_of, DerivedHiddenCons, + HiddenCons>(false)) ); + VERIFY( (test_relationship<is_base_of, MultiDerivedHiddenCons, + HiddenCons>(false)) ); + VERIFY( (test_relationship<is_base_of, MultiDerivedHiddenCons, + ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..4a372bf46 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_class<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/requirements/typedefs.cc new file mode 100644 index 000000000..9ed7f2386 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2007-04-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + 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; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/value.cc new file mode 100644 index 000000000..1fe8fe100 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_class/value.cc @@ -0,0 +1,60 @@ +// 2007-04-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007, 2009 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/>. + +// 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/is_compound/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_compound/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..4d6b10c48 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_compound/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_compound<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_compound/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_compound/requirements/typedefs.cc new file mode 100644 index 000000000..b5bb750b5 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_compound/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_compound<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/is_compound/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_compound/value.cc new file mode 100644 index 000000000..69992f1d0 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_compound/value.cc @@ -0,0 +1,59 @@ +// 2004-12-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_compound; + using namespace __gnu_test; + + VERIFY( (test_category<is_compound, void>(false)) ); + VERIFY( (test_category<is_compound, char>(false)) ); + VERIFY( (test_category<is_compound, signed char>(false)) ); + VERIFY( (test_category<is_compound, unsigned char>(false)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_compound, wchar_t>(false)) ); +#endif + VERIFY( (test_category<is_compound, short>(false)) ); + VERIFY( (test_category<is_compound, unsigned short>(false)) ); + VERIFY( (test_category<is_compound, int>(false)) ); + VERIFY( (test_category<is_compound, unsigned int>(false)) ); + VERIFY( (test_category<is_compound, long>(false)) ); + VERIFY( (test_category<is_compound, unsigned long>(false)) ); + VERIFY( (test_category<is_compound, long long>(false)) ); + VERIFY( (test_category<is_compound, unsigned long long>(false)) ); + VERIFY( (test_category<is_compound, float>(false)) ); + VERIFY( (test_category<is_compound, double>(false)) ); + VERIFY( (test_category<is_compound, long double>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_compound, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..2c7d72574 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_const<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/requirements/typedefs.cc new file mode 100644 index 000000000..ee4b1817a --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-07 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_const/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/value.cc new file mode 100644 index 000000000..2f6bd135f --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_const/value.cc @@ -0,0 +1,49 @@ +// 2004-12-07 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_const; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_property<is_const, const int>(true)) ); + VERIFY( (test_property<is_const, const volatile int>(true)) ); + VERIFY( (test_property<is_const, cClassType>(true)) ); + VERIFY( (test_property<is_const, cvClassType>(true)) ); + + // Negative tests. + VERIFY( (test_property<is_const, int>(false)) ); + VERIFY( (test_property<is_const, volatile int>(false)) ); + VERIFY( (test_property<is_const, ClassType>(false)) ); + VERIFY( (test_property<is_const, vClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..c1481c586 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_convertible<test_type, test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/requirements/typedefs.cc new file mode 100644 index 000000000..a75506b84 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-02-23 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_convertible<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/tr1/4_metaprogramming/is_convertible/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/value.cc new file mode 100644 index 000000000..9a677ec11 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_convertible/value.cc @@ -0,0 +1,86 @@ +// 2005-02-23 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.6 Relationships between types + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_convertible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_relationship<is_convertible, int, int>(true)) ); + VERIFY( (test_relationship<is_convertible, int, const int>(true)) ); + VERIFY( (test_relationship<is_convertible, volatile int, const int>(true)) ); + VERIFY( (test_relationship<is_convertible, int, float>(true)) ); + VERIFY( (test_relationship<is_convertible, double, float>(true)) ); + VERIFY( (test_relationship<is_convertible, float, int>(true)) ); + VERIFY( (test_relationship<is_convertible, int*, const int*>(true)) ); + VERIFY( (test_relationship<is_convertible, int*, void*>(true)) ); + VERIFY( (test_relationship<is_convertible, int[4], int*>(true)) ); + VERIFY( (test_relationship<is_convertible, float&, int>(true)) ); + VERIFY( (test_relationship<is_convertible, int, const int&>(true)) ); + VERIFY( (test_relationship<is_convertible, const int&, int>(true)) ); + VERIFY( (test_relationship<is_convertible, float, const int&>(true)) ); + VERIFY( (test_relationship<is_convertible, float, volatile float&>(true)) ); + VERIFY( (test_relationship<is_convertible, int(int), int(*)(int)>(true)) ); + VERIFY( (test_relationship<is_convertible, int(int), int(&)(int)>(true)) ); + VERIFY( (test_relationship<is_convertible, int(&)(int), int(*)(int)>(true)) ); + VERIFY( (test_relationship<is_convertible, EnumType, int>(true)) ); + VERIFY( (test_relationship<is_convertible, ClassType, ClassType>(true)) ); + VERIFY( (test_relationship<is_convertible, DerivedType, ClassType>(true)) ); + VERIFY( (test_relationship<is_convertible, DerivedType*, ClassType*>(true)) ); + VERIFY( (test_relationship<is_convertible, DerivedType&, ClassType&>(true)) ); + + VERIFY( (test_relationship<is_convertible, void, void>(true)) ); + VERIFY( (test_relationship<is_convertible, int, void>(true)) ); + VERIFY( (test_relationship<is_convertible, int[4], void>(true)) ); + + // Negative tests. + VERIFY( (test_relationship<is_convertible, const int*, int*>(false)) ); + VERIFY( (test_relationship<is_convertible, int*, float*>(false)) ); + VERIFY( (test_relationship<is_convertible, const int[4], int*>(false)) ); + VERIFY( (test_relationship<is_convertible, int[4], int[4]>(false)) ); + VERIFY( (test_relationship<is_convertible, const int&, int&>(false)) ); + VERIFY( (test_relationship<is_convertible, float&, int&>(false)) ); + VERIFY( (test_relationship<is_convertible, float, volatile int&>(false)) ); + VERIFY( (test_relationship<is_convertible, int(int), int(int)>(false)) ); + VERIFY( (test_relationship<is_convertible, int(int), int(*)(void)>(false)) ); + VERIFY( (test_relationship<is_convertible, int(*)(int), int(&)(int)>(false)) ); + VERIFY( (test_relationship<is_convertible, int, EnumType>(false)) ); + VERIFY( (test_relationship<is_convertible, int, ClassType>(false)) ); + VERIFY( (test_relationship<is_convertible, ClassType, DerivedType>(false)) ); + VERIFY( (test_relationship<is_convertible, ClassType*, DerivedType*>(false)) ); + VERIFY( (test_relationship<is_convertible, ClassType&, DerivedType&>(false)) ); + + VERIFY( (test_relationship<is_convertible, void, int>(false)) ); + VERIFY( (test_relationship<is_convertible, void, float>(false)) ); + VERIFY( (test_relationship<is_convertible, void, int(*)(int)>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..dc52336a3 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_empty<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/requirements/typedefs.cc new file mode 100644 index 000000000..876c576c0 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-01-28 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_empty/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/value.cc new file mode 100644 index 000000000..d2980510b --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_empty/value.cc @@ -0,0 +1,75 @@ +// 2005-01-28 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#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() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_empty; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_empty, ClassType>(true)) ); + VERIFY( (test_category<is_empty, EmptyClassOne>(true)) ); + VERIFY( (test_category<is_empty, EmptyClassTwo>(true)) ); + VERIFY( (test_category<is_empty, EmptyClassThree>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_empty, void>(false)) ); + VERIFY( (test_category<is_empty, float>(false)) ); + VERIFY( (test_category<is_empty, int[4]>(false)) ); + VERIFY( (test_category<is_empty, int*>(false)) ); + VERIFY( (test_category<is_empty, int&>(false)) ); + VERIFY( (test_category<is_empty, int (ClassType::*)>(false)) ); + VERIFY( (test_category<is_empty, EnumType>(false)) ); + VERIFY( (test_category<is_empty, int (int)>(false)) ); + + VERIFY( (test_category<is_empty, AbstractClass>(false)) ); + VERIFY( (test_category<is_empty, NonEmptyClassOne>(false)) ); + VERIFY( (test_category<is_empty, NonEmptyClassTwo>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/24808.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/24808.cc new file mode 100644 index 000000000..b59e826d6 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/24808.cc @@ -0,0 +1,40 @@ +// 2005-11-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.1 Primary type categories + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +// libstdc++/24808 +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_enum; + using namespace __gnu_test; + + VERIFY( (test_category<is_enum, IncompleteClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..fd962fabe --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_enum<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/requirements/typedefs.cc new file mode 100644 index 000000000..4fe26b8a7 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-25 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_enum/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/value.cc new file mode 100644 index 000000000..ccacfd94d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_enum/value.cc @@ -0,0 +1,58 @@ +// 2004-12-25 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_enum; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_enum, EnumType>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_enum, void>(false)) ); + VERIFY( (test_category<is_enum, int>(false)) ); + VERIFY( (test_category<is_enum, float>(false)) ); + VERIFY( (test_category<is_enum, int[2]>(false)) ); + VERIFY( (test_category<is_enum, int*>(false)) ); + VERIFY( (test_category<is_enum, int(*)(int)>(false)) ); + VERIFY( (test_category<is_enum, float&>(false)) ); + VERIFY( (test_category<is_enum, float(&)(float)>(false)) ); + VERIFY( (test_category<is_enum, int (ClassType::*)>(false)) ); + VERIFY( (test_category<is_enum, int (ClassType::*) (int)>(false)) ); + VERIFY( (test_category<is_enum, int (int)>(false)) ); + + VERIFY( (test_category<is_enum, ConvType>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_enum, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..0ca78b427 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_floating_point<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/requirements/typedefs.cc new file mode 100644 index 000000000..471fdd472 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_floating_point<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/is_floating_point/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/value.cc new file mode 100644 index 000000000..e227cf45b --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_floating_point/value.cc @@ -0,0 +1,60 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_floating_point; + using namespace __gnu_test; + + VERIFY( (test_category<is_floating_point, void>(false)) ); + VERIFY( (test_category<is_floating_point, char>(false)) ); + VERIFY( (test_category<is_floating_point, signed char>(false)) ); + VERIFY( (test_category<is_floating_point, unsigned char>(false)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_floating_point, wchar_t>(false)) ); +#endif + VERIFY( (test_category<is_floating_point, short>(false)) ); + VERIFY( (test_category<is_floating_point, unsigned short>(false)) ); + VERIFY( (test_category<is_floating_point, int>(false)) ); + VERIFY( (test_category<is_floating_point, unsigned int>(false)) ); + VERIFY( (test_category<is_floating_point, long>(false)) ); + VERIFY( (test_category<is_floating_point, unsigned long>(false)) ); + VERIFY( (test_category<is_floating_point, long long>(false)) ); + VERIFY( (test_category<is_floating_point, unsigned long long>(false)) ); + + VERIFY( (test_category<is_floating_point, float>(true)) ); + VERIFY( (test_category<is_floating_point, double>(true)) ); + VERIFY( (test_category<is_floating_point, long double>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_floating_point, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/24808.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/24808.cc new file mode 100644 index 000000000..b57161fa3 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/24808.cc @@ -0,0 +1,40 @@ +// 2005-11-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.1 Primary type categories + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +// libstdc++/24808 +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_function; + using namespace __gnu_test; + + VERIFY( (test_category<is_function, IncompleteClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/35637.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/35637.cc new file mode 100644 index 000000000..efd5db402 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/35637.cc @@ -0,0 +1,34 @@ +// { dg-options "-pedantic-errors" } +// { dg-do compile } + +// Copyright (C) 2008, 2009 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/>. + +// 4.5.1 Primary type categories + +#include <tr1/functional> + +struct S +{ + void F() const {} +}; + +// libstdc++/35637 +void test01() +{ + std::tr1::function<void (S *)> a(&S::F); +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..d15ac23cf --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_function<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/requirements/typedefs.cc new file mode 100644 index 000000000..5503e1f88 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-16 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_function<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/is_function/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/value.cc new file mode 100644 index 000000000..30e26d768 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_function/value.cc @@ -0,0 +1,54 @@ +// 2004-12-16 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 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_function; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_function, int (int)>(true)) ); + VERIFY( (test_category<is_function, ClassType (ClassType)>(true)) ); + VERIFY( (test_category<is_function, float (int, float, int[], int&)>(true)) ); + VERIFY( (test_category<is_function, int (int, ...)>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_function, int&>(false)) ); + VERIFY( (test_category<is_function, void>(false)) ); + VERIFY( (test_category<is_function, const void>(false)) ); + + VERIFY( (test_category<is_function, AbstractClass>(false)) ); + VERIFY( (test_category<is_function, int(&)(int)>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_function, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..dcecc44d8 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_fundamental<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/requirements/typedefs.cc new file mode 100644 index 000000000..116afebf8 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_fundamental<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/is_fundamental/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/value.cc new file mode 100644 index 000000000..f2e2c4ade --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_fundamental/value.cc @@ -0,0 +1,59 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_fundamental; + using namespace __gnu_test; + + VERIFY( (test_category<is_fundamental, void>(true)) ); + VERIFY( (test_category<is_fundamental, char>(true)) ); + VERIFY( (test_category<is_fundamental, signed char>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned char>(true)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_fundamental, wchar_t>(true)) ); +#endif + VERIFY( (test_category<is_fundamental, short>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned short>(true)) ); + VERIFY( (test_category<is_fundamental, int>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned int>(true)) ); + VERIFY( (test_category<is_fundamental, long>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned long>(true)) ); + VERIFY( (test_category<is_fundamental, long long>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned long long>(true)) ); + VERIFY( (test_category<is_fundamental, float>(true)) ); + VERIFY( (test_category<is_fundamental, double>(true)) ); + VERIFY( (test_category<is_fundamental, long double>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_fundamental, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..f806cf39b --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_integral<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/requirements/typedefs.cc new file mode 100644 index 000000000..92601999e --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_integral<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/is_integral/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/value.cc new file mode 100644 index 000000000..9cd4ef801 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_integral/value.cc @@ -0,0 +1,61 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_integral; + using namespace __gnu_test; + + VERIFY( (test_category<is_integral, void>(false)) ); + + VERIFY( (test_category<is_integral, char>(true)) ); + VERIFY( (test_category<is_integral, signed char>(true)) ); + VERIFY( (test_category<is_integral, unsigned char>(true)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_integral, wchar_t>(true)) ); +#endif + VERIFY( (test_category<is_integral, short>(true)) ); + VERIFY( (test_category<is_integral, unsigned short>(true)) ); + VERIFY( (test_category<is_integral, int>(true)) ); + VERIFY( (test_category<is_integral, unsigned int>(true)) ); + VERIFY( (test_category<is_integral, long>(true)) ); + VERIFY( (test_category<is_integral, unsigned long>(true)) ); + VERIFY( (test_category<is_integral, long long>(true)) ); + VERIFY( (test_category<is_integral, unsigned long long>(true)) ); + + VERIFY( (test_category<is_integral, float>(false)) ); + VERIFY( (test_category<is_integral, double>(false)) ); + VERIFY( (test_category<is_integral, long double>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_integral, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..02d470305 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_member_function_pointer<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/requirements/typedefs.cc new file mode 100644 index 000000000..39083321e --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 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/is_member_function_pointer/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/value.cc new file mode 100644 index 000000000..ef6bd9980 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/value.cc @@ -0,0 +1,60 @@ +// 2004-12-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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. + VERIFY( (test_category<is_member_function_pointer, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + int (ClassType::*) (int) const>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + int (ClassType::*) (float, ...)>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + ClassType (ClassType::*) (ClassType)>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + float (ClassType::*) (int, float, int[], int&)>(true)) ); + + // 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/is_member_object_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..6f92ba189 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_member_object_pointer<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/requirements/typedefs.cc new file mode 100644 index 000000000..823a701eb --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 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; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/value.cc new file mode 100644 index 000000000..34871e452 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_object_pointer/value.cc @@ -0,0 +1,60 @@ +// 2004-12-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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, + int (ClassType::*) (float, ...)>(false)) ); + VERIFY( (test_category<is_member_object_pointer, + ClassType (ClassType::*) (ClassType)>(false)) ); + VERIFY( (test_category<is_member_object_pointer, + float (ClassType::*) (int, float, int[], int&)>(false)) ); + + // 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/is_member_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..99d1222c7 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_member_pointer<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_pointer/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_pointer/requirements/typedefs.cc new file mode 100644 index 000000000..1f8df3856 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_pointer/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 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/is_member_pointer/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_pointer/value.cc new file mode 100644 index 000000000..37db405f1 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_pointer/value.cc @@ -0,0 +1,55 @@ +// 2004-12-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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)) ); + + VERIFY( (test_category<is_member_pointer, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<is_member_pointer, + int (ClassType::*) (int) const>(true)) ); + VERIFY( (test_category<is_member_pointer, + int (ClassType::*) (float, ...)>(true)) ); + VERIFY( (test_category<is_member_pointer, + ClassType (ClassType::*) (ClassType)>(true)) ); + VERIFY( (test_category<is_member_pointer, + float (ClassType::*) (int, float, int[], int&)>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_member_pointer, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/24808.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/24808.cc new file mode 100644 index 000000000..50cd97dd6 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/24808.cc @@ -0,0 +1,40 @@ +// 2005-11-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.2 Composite type traits + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +// libstdc++/24808 +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_object; + using namespace __gnu_test; + + VERIFY( (test_category<is_object, IncompleteClass>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..2bb025b5c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_object<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/requirements/typedefs.cc new file mode 100644 index 000000000..31c526b3f --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-16 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_object<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/is_object/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/value.cc new file mode 100644 index 000000000..a3c954d8d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_object/value.cc @@ -0,0 +1,49 @@ +// 2004-12-16 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_object; + using namespace __gnu_test; + + VERIFY( (test_category<is_object, int (int)>(false)) ); + VERIFY( (test_category<is_object, ClassType (ClassType)>(false)) ); + VERIFY( (test_category<is_object, float (int, float, int[], int&)>(false)) ); + VERIFY( (test_category<is_object, int&>(false)) ); + VERIFY( (test_category<is_object, ClassType&>(false)) ); + VERIFY( (test_category<is_object, int(&)(int)>(false)) ); + VERIFY( (test_category<is_object, void>(false)) ); + VERIFY( (test_category<is_object, const void>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_object, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..97de6aa1b --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_pod<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/requirements/typedefs.cc new file mode 100644 index 000000000..22950c3aa --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_pod<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/is_pod/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/value.cc new file mode 100644 index 000000000..6cf88c922 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pod/value.cc @@ -0,0 +1,54 @@ +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_pod; + using namespace __gnu_test; + + VERIFY( (test_category<is_pod, void>(true)) ); + VERIFY( (test_category<is_pod, int>(true)) ); + VERIFY( (test_category<is_pod, float>(true)) ); + VERIFY( (test_category<is_pod, EnumType>(true)) ); + VERIFY( (test_category<is_pod, int*>(true)) ); + VERIFY( (test_category<is_pod, int(*)(int)>(true)) ); + VERIFY( (test_category<is_pod, int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_pod, int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<is_pod, int[2]>(true)) ); + VERIFY( (test_category<is_pod, float[][3]>(true)) ); + VERIFY( (test_category<is_pod, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<is_pod, int*[3]>(true)) ); + VERIFY( (test_category<is_pod, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<is_pod, int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<is_pod, int (ClassType::*[][2][3]) (int)>(true)) ); + VERIFY( (test_category<is_pod, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..fd820d557 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_pointer<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/requirements/typedefs.cc new file mode 100644 index 000000000..806ee5738 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_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/is_pointer/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/value.cc new file mode 100644 index 000000000..e4a7e3cd2 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_pointer/value.cc @@ -0,0 +1,44 @@ +// 2004-12-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_pointer; + using namespace __gnu_test; + + VERIFY( (test_category<is_pointer, int*>(true)) ); + VERIFY( (test_category<is_pointer, ClassType*>(true)) ); + VERIFY( (test_category<is_pointer, int(*)(int)>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_pointer, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/24809.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/24809.cc new file mode 100644 index 000000000..7c479344a --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/24809.cc @@ -0,0 +1,26 @@ +// { dg-do compile } + +// Copyright (C) 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <exception> + +// libstdc++/24809 +static const bool b = std::tr1::is_polymorphic<std::exception>::value; diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..890fa0db3 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_polymorphic<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/requirements/typedefs.cc new file mode 100644 index 000000000..cb612f99f --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-03-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_polymorphic/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/value.cc new file mode 100644 index 000000000..c73c2d6f9 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_polymorphic/value.cc @@ -0,0 +1,54 @@ +// 2005-03-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2006, 2007, 2009 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/>. + +// 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::is_polymorphic; + using namespace __gnu_test; + + // Positive tests. + 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)) ); + + // Negative tests. + VERIFY( (test_category<is_polymorphic, void>(false)) ); + VERIFY( (test_category<is_polymorphic, int (int)>(false)) ); + VERIFY( (test_category<is_polymorphic, int&>(false)) ); + VERIFY( (test_category<is_polymorphic, EnumType>(false)) ); + VERIFY( (test_category<is_polymorphic, ClassType>(false)) ); + VERIFY( (test_category<is_polymorphic, DerivedType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..cf141a364 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_reference<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/requirements/typedefs.cc new file mode 100644 index 000000000..e64db083a --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-06 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_reference<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/is_reference/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/value.cc new file mode 100644 index 000000000..6eae838dd --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_reference/value.cc @@ -0,0 +1,44 @@ +// 2004-12-06 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_reference; + using namespace __gnu_test; + + VERIFY( (test_category<is_reference, int&>(true)) ); + VERIFY( (test_category<is_reference, ClassType&>(true)) ); + VERIFY( (test_category<is_reference, int(&)(int)>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_reference, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..8a862e736 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_same<test_type, test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/requirements/typedefs.cc new file mode 100644 index 000000000..5adb7a159 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_same/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/value.cc new file mode 100644 index 000000000..b98754ad9 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_same/value.cc @@ -0,0 +1,49 @@ +// 2004-12-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.6 Relationships between types + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_same; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_relationship<is_same, int, int>(true)) ); + VERIFY( (test_relationship<is_same, const int, const int>(true)) ); + VERIFY( (test_relationship<is_same, int&, int&>(true)) ); + VERIFY( (test_relationship<is_same, ClassType, ClassType>(true)) ); + + // Negative tests. + VERIFY( (test_relationship<is_same, void, int>(false)) ); + VERIFY( (test_relationship<is_same, int, const int>(false)) ); + VERIFY( (test_relationship<is_same, int, int&>(false)) ); + VERIFY( (test_relationship<is_same, int, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..bf127cf2d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_scalar<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/requirements/typedefs.cc new file mode 100644 index 000000000..2513a20dc --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-25 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_scalar<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/is_scalar/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/value.cc new file mode 100644 index 000000000..567b6d9b2 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_scalar/value.cc @@ -0,0 +1,48 @@ +// 2004-12-25 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_scalar; + using namespace __gnu_test; + + VERIFY( (test_category<is_scalar, int>(true)) ); + VERIFY( (test_category<is_scalar, float>(true)) ); + VERIFY( (test_category<is_scalar, EnumType>(true)) ); + VERIFY( (test_category<is_scalar, int*>(true)) ); + VERIFY( (test_category<is_scalar, int(*)(int)>(true)) ); + VERIFY( (test_category<is_scalar, int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_scalar, int (ClassType::*) (int)>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_scalar, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..db5fbe48d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_signed<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/requirements/typedefs.cc new file mode 100644 index 000000000..27f319317 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-01-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_signed<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/is_signed/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/value.cc new file mode 100644 index 000000000..e19a1eac2 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_signed/value.cc @@ -0,0 +1,61 @@ +// 2005-01-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_signed; + using namespace __gnu_test; + + VERIFY( (test_category<is_signed, void>(false)) ); + + VERIFY( (test_category<is_signed, char>(false)) ); + VERIFY( (test_category<is_signed, signed char>(true)) ); + VERIFY( (test_category<is_signed, unsigned char>(false)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_signed, wchar_t>(false)) ); +#endif + VERIFY( (test_category<is_signed, short>(true)) ); + VERIFY( (test_category<is_signed, unsigned short>(false)) ); + VERIFY( (test_category<is_signed, int>(true)) ); + VERIFY( (test_category<is_signed, unsigned int>(false)) ); + VERIFY( (test_category<is_signed, long>(true)) ); + VERIFY( (test_category<is_signed, unsigned long>(false)) ); + VERIFY( (test_category<is_signed, long long>(true)) ); + VERIFY( (test_category<is_signed, unsigned long long>(false)) ); + + VERIFY( (test_category<is_signed, float>(false)) ); + VERIFY( (test_category<is_signed, double>(false)) ); + VERIFY( (test_category<is_signed, long double>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_signed, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..7e9e6ea4f --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_union<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/requirements/typedefs.cc new file mode 100644 index 000000000..0d352765c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2007-04-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007, 2009 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 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/is_union/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/value.cc new file mode 100644 index 000000000..90ace4937 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_union/value.cc @@ -0,0 +1,60 @@ +// 2007-04-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007, 2009 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/>. + +// 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/is_unsigned/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_unsigned/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..da382cdbe --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_unsigned/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_unsigned<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_unsigned/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_unsigned/requirements/typedefs.cc new file mode 100644 index 000000000..381a15d59 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_unsigned/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2005-01-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_unsigned<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/is_unsigned/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_unsigned/value.cc new file mode 100644 index 000000000..991d9cf6d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_unsigned/value.cc @@ -0,0 +1,61 @@ +// 2005-01-24 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2005, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_unsigned; + using namespace __gnu_test; + + VERIFY( (test_category<is_unsigned, void>(false)) ); + + VERIFY( (test_category<is_unsigned, char>(false)) ); + VERIFY( (test_category<is_unsigned, signed char>(false)) ); + VERIFY( (test_category<is_unsigned, unsigned char>(true)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_unsigned, wchar_t>(false)) ); +#endif + VERIFY( (test_category<is_unsigned, short>(false)) ); + VERIFY( (test_category<is_unsigned, unsigned short>(true)) ); + VERIFY( (test_category<is_unsigned, int>(false)) ); + VERIFY( (test_category<is_unsigned, unsigned int>(true)) ); + VERIFY( (test_category<is_unsigned, long>(false)) ); + VERIFY( (test_category<is_unsigned, unsigned long>(true)) ); + VERIFY( (test_category<is_unsigned, long long>(false)) ); + VERIFY( (test_category<is_unsigned, unsigned long long>(true)) ); + + VERIFY( (test_category<is_unsigned, float>(false)) ); + VERIFY( (test_category<is_unsigned, double>(false)) ); + VERIFY( (test_category<is_unsigned, long double>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_unsigned, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..3dcb5da73 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_void<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/requirements/typedefs.cc new file mode 100644 index 000000000..c3c005036 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_void/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/value.cc new file mode 100644 index 000000000..76676c322 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_void/value.cc @@ -0,0 +1,60 @@ +// 2004-12-03 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 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_void; + using namespace __gnu_test; + + VERIFY( (test_category<is_void, void>(true)) ); + + VERIFY( (test_category<is_void, char>(false)) ); + VERIFY( (test_category<is_void, signed char>(false)) ); + VERIFY( (test_category<is_void, unsigned char>(false)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_void, wchar_t>(false)) ); +#endif + VERIFY( (test_category<is_void, short>(false)) ); + VERIFY( (test_category<is_void, unsigned short>(false)) ); + VERIFY( (test_category<is_void, int>(false)) ); + VERIFY( (test_category<is_void, unsigned int>(false)) ); + VERIFY( (test_category<is_void, long>(false)) ); + VERIFY( (test_category<is_void, unsigned long>(false)) ); + VERIFY( (test_category<is_void, long long>(false)) ); + VERIFY( (test_category<is_void, unsigned long long>(false)) ); + VERIFY( (test_category<is_void, float>(false)) ); + VERIFY( (test_category<is_void, double>(false)) ); + VERIFY( (test_category<is_void, long double>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_void, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..d09b08b7c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct is_volatile<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/requirements/typedefs.cc new file mode 100644 index 000000000..b52b5dae5 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-07 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/is_volatile/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/value.cc new file mode 100644 index 000000000..3453c6e0f --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/is_volatile/value.cc @@ -0,0 +1,49 @@ +// 2004-12-07 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_volatile; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_property<is_volatile, volatile int>(true)) ); + VERIFY( (test_property<is_volatile, const volatile int>(true)) ); + VERIFY( (test_property<is_volatile, vClassType>(true)) ); + VERIFY( (test_property<is_volatile, cvClassType>(true)) ); + + // Negative tests. + VERIFY( (test_property<is_volatile, int>(false)) ); + VERIFY( (test_property<is_volatile, const int>(false)) ); + VERIFY( (test_property<is_volatile, ClassType>(false)) ); + VERIFY( (test_property<is_volatile, cClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..f3aa7f658 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct rank<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/requirements/typedefs.cc new file mode 100644 index 000000000..74982f1e6 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// 2004-12-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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 tr1/type_traits with NO OTHER INCLUDES. + +#include <tr1/type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::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/tr1/4_metaprogramming/rank/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/value.cc new file mode 100644 index 000000000..ff001ec96 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/rank/value.cc @@ -0,0 +1,46 @@ +// 2004-12-11 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.5.3 Type properties + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::rank; + using namespace __gnu_test; + + VERIFY( (test_property<rank, int>(0)) ); + VERIFY( (test_property<rank, int[2]>(1)) ); + VERIFY( (test_property<rank, int[][4]>(2)) ); + VERIFY( (test_property<rank, int[2][2][4][4][6][6]>(6)) ); + VERIFY( (test_property<rank, ClassType>(0)) ); + VERIFY( (test_property<rank, ClassType[2]>(1)) ); + VERIFY( (test_property<rank, ClassType[][4]>(2)) ); + VERIFY( (test_property<rank, ClassType[2][2][4][4][6][6]>(6)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_all_extents/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_all_extents/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..0dc8510f0 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_all_extents/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct remove_all_extents<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_all_extents/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_all_extents/value.cc new file mode 100644 index 000000000..eb97b7274 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_all_extents/value.cc @@ -0,0 +1,53 @@ +// 2004-12-09 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.7.3 Array modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::remove_all_extents; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<remove_all_extents<int>::type, int>::value) ); + VERIFY( (is_same<remove_all_extents<int[2]>::type, int>::value) ); + VERIFY( (is_same<remove_all_extents<int[2][3]>::type, int>::value) ); + VERIFY( (is_same<remove_all_extents<int[][3]>::type, int>::value) ); + VERIFY( (is_same<remove_all_extents<const int[2][3]>::type, + const int>::value) ); + VERIFY( (is_same<remove_all_extents<ClassType>::type, ClassType>::value) ); + VERIFY( (is_same<remove_all_extents<ClassType[2]>::type, ClassType>::value) ); + VERIFY( (is_same<remove_all_extents<ClassType[2][3]>::type, + ClassType>::value) ); + VERIFY( (is_same<remove_all_extents<ClassType[][3]>::type, + ClassType>::value) ); + VERIFY( (is_same<remove_all_extents<const ClassType[2][3]>::type, + const ClassType>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_const/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_const/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..87fffe1bd --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_const/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct remove_const<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_const/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_const/value.cc new file mode 100644 index 000000000..f3ad1502e --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_const/value.cc @@ -0,0 +1,46 @@ +// 2004-12-10 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.7.1 Const-volatile modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::remove_const; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<remove_const<const volatile int>::type, + volatile int>::value) ); + VERIFY( (is_same<remove_const<const int*>::type, const int*>::value) ); + VERIFY( (is_same<remove_const<const volatile ClassType>::type, + volatile ClassType>::value) ); + VERIFY( (is_same<remove_const<const ClassType*>::type, + const ClassType*>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_cv/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_cv/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..50a3dc551 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_cv/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct remove_cv<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_cv/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_cv/value.cc new file mode 100644 index 000000000..5e9f397cf --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_cv/value.cc @@ -0,0 +1,46 @@ +// 2004-12-10 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.7.1 Const-volatile modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::remove_cv; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<remove_cv<const volatile int>::type, int>::value) ); + VERIFY( (is_same<remove_cv<const volatile int*>::type, + const volatile int*>::value) ); + VERIFY( (is_same<remove_cv<const volatile ClassType>::type, + ClassType>::value) ); + VERIFY( (is_same<remove_cv<const volatile ClassType*>::type, + const volatile ClassType*>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_extent/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_extent/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..dd15bcbe4 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_extent/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct remove_extent<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_extent/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_extent/value.cc new file mode 100644 index 000000000..322aa2d89 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_extent/value.cc @@ -0,0 +1,52 @@ +// 2004-12-09 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.7.3 Array modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::remove_extent; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<remove_extent<int>::type, int>::value) ); + VERIFY( (is_same<remove_extent<int[2]>::type, int>::value) ); + VERIFY( (is_same<remove_extent<int[2][3]>::type, int[3]>::value) ); + VERIFY( (is_same<remove_extent<int[][3]>::type, int[3]>::value) ); + VERIFY( (is_same<remove_extent<const int[2]>::type, const int>::value) ); + VERIFY( (is_same<remove_extent<ClassType>::type, ClassType>::value) ); + VERIFY( (is_same<remove_extent<ClassType[2]>::type, ClassType>::value) ); + VERIFY( (is_same<remove_extent<ClassType[2][3]>::type, + ClassType[3]>::value) ); + VERIFY( (is_same<remove_extent<ClassType[][3]>::type, + ClassType[3]>::value) ); + VERIFY( (is_same<remove_extent<const ClassType[2]>::type, + const ClassType>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..aa19e24c2 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct remove_pointer<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_pointer/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_pointer/value.cc new file mode 100644 index 000000000..c6cf05332 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_pointer/value.cc @@ -0,0 +1,45 @@ +// 2004-12-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.7.2 Reference modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::remove_pointer; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<remove_pointer<int*>::type, int>::value) ); + VERIFY( (is_same<remove_pointer<int>::type, int>::value) ); + VERIFY( (is_same<remove_pointer<const int*>::type, const int>::value) ); + VERIFY( (is_same<remove_pointer<int**>::type, int*>::value) ); + VERIFY( (is_same<remove_pointer<ClassType*>::type, ClassType>::value) ); + VERIFY( (is_same<remove_pointer<ClassType>::type, ClassType>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_reference/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_reference/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..778c75b57 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_reference/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct remove_reference<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_reference/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_reference/value.cc new file mode 100644 index 000000000..8ad89b2bb --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_reference/value.cc @@ -0,0 +1,45 @@ +// 2004-12-08 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.7.2 Reference modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::remove_reference; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<remove_reference<int&>::type, int>::value) ); + VERIFY( (is_same<remove_reference<int>::type, int>::value) ); + VERIFY( (is_same<remove_reference<const int&>::type, const int>::value) ); + VERIFY( (is_same<remove_reference<int*&>::type, int*>::value) ); + VERIFY( (is_same<remove_reference<ClassType&>::type, ClassType>::value) ); + VERIFY( (is_same<remove_reference<ClassType>::type, ClassType>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_volatile/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_volatile/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..4f39bd13d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_volatile/requirements/explicit_instantiation.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007, 2009 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 <tr1/type_traits> + +namespace std +{ + namespace tr1 + { + typedef short test_type; + template struct remove_volatile<test_type>; + } +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_volatile/value.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_volatile/value.cc new file mode 100644 index 000000000..48d9876a0 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/remove_volatile/value.cc @@ -0,0 +1,47 @@ +// 2004-12-10 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2009 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/>. + +// 4.7.1 Const-volatile modifications + +#include <tr1/type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::remove_volatile; + using std::tr1::is_same; + using namespace __gnu_test; + + VERIFY( (is_same<remove_volatile<const volatile int>::type, + const int>::value) ); + VERIFY( (is_same<remove_volatile<volatile int*>::type, + volatile int*>::value) ); + VERIFY( (is_same<remove_volatile<const volatile ClassType>::type, + const ClassType>::value) ); + VERIFY( (is_same<remove_volatile<volatile ClassType*>::type, + volatile ClassType*>::value) ); +} + +int main() +{ + test01(); + return 0; +} |