From 65cee9bdb7b5975151802bd805ba720f540dec8d Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 19 Apr 2011 00:10:53 +0000 Subject: type_traits (is_nothrow_default_constructible, [...]): Add. 2011-04-18 Paolo Carlini * include/std/type_traits (is_nothrow_default_constructible, is_nothrow_copy_constructible, is_nothrow_move_constructible, is_copy_constructible, is_move_constructible): Add. (has_nothrow_default_constructor, has_nothrow_copy_constructor): Remove. (is_nothrow_constructible): Adjust. * testsuite/util/testsuite_tr1.h (ThrowDefaultClass, ThrowCopyConsClass, ThrowMoveConsClass, NoexceptDefaultClass, ExceptDefaultClass, NoexceptCopyConsClass, ExceptCopyConsClass, NoexceptMoveConsClass, ExceptMoveConsClass): Add in C++0x mode. * testsuite/20_util/has_nothrow_default_constructor: Remove. * testsuite/20_util/has_nothrow_copy_constructor: Likewise. * testsuite/20_util/is_nothrow_move_constructible/value.cc: Likewise. * testsuite/20_util/is_nothrow_move_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_move_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_copy_constructible/value.cc: Likewise. * testsuite/20_util/is_nothrow_copy_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_copy_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_default_constructible/value.cc: Likewise. * testsuite/20_util/is_nothrow_default_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_default_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_move_constructible/value.cc: Likewise. * testsuite/20_util/is_move_constructible/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_move_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_copy_constructible/value.cc: Likewise. * testsuite/20_util/is_copy_constructible/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_copy_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_default_constructible/value.cc: Add tests. * testsuite/20_util/is_nothrow_constructible/value.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. From-SVN: r172684 --- libstdc++-v3/ChangeLog | 53 ++++++++ libstdc++-v3/include/std/type_traits | 147 ++++++++++++++++----- .../20_util/declval/requirements/1_neg.cc | 2 +- .../requirements/explicit_instantiation.cc | 31 ----- .../requirements/typedefs.cc | 36 ----- .../20_util/has_nothrow_copy_constructor/value.cc | 56 -------- .../requirements/explicit_instantiation.cc | 31 ----- .../requirements/typedefs.cc | 36 ----- .../has_nothrow_default_constructor/value.cc | 61 --------- .../requirements/explicit_instantiation.cc | 29 ++++ .../is_copy_constructible/requirements/typedefs.cc | 34 +++++ .../20_util/is_copy_constructible/value.cc | 73 ++++++++++ .../20_util/is_default_constructible/value.cc | 7 + .../requirements/explicit_instantiation.cc | 29 ++++ .../is_move_constructible/requirements/typedefs.cc | 34 +++++ .../20_util/is_move_constructible/value.cc | 73 ++++++++++ .../20_util/is_nothrow_constructible/value.cc | 6 +- .../requirements/explicit_instantiation.cc | 30 +++++ .../requirements/typedefs.cc | 36 +++++ .../20_util/is_nothrow_copy_constructible/value.cc | 74 +++++++++++ .../requirements/explicit_instantiation.cc | 30 +++++ .../requirements/typedefs.cc | 36 +++++ .../is_nothrow_default_constructible/value.cc | 74 +++++++++++ .../requirements/explicit_instantiation.cc | 29 ++++ .../requirements/typedefs.cc | 34 +++++ .../20_util/is_nothrow_move_constructible/value.cc | 73 ++++++++++ .../make_signed/requirements/typedefs_neg.cc | 4 +- .../make_unsigned/requirements/typedefs_neg.cc | 4 +- libstdc++-v3/testsuite/util/testsuite_tr1.h | 45 +++++++ 29 files changed, 920 insertions(+), 287 deletions(-) delete mode 100644 libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc delete mode 100644 libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc delete mode 100644 libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc delete mode 100644 libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc delete mode 100644 libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc delete mode 100644 libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_move_constructible/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/value.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index dd2b053..6eaa026 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,56 @@ +2011-04-18 Paolo Carlini + + * include/std/type_traits (is_nothrow_default_constructible, + is_nothrow_copy_constructible, is_nothrow_move_constructible, + is_copy_constructible, is_move_constructible): Add. + (has_nothrow_default_constructor, has_nothrow_copy_constructor): + Remove. + (is_nothrow_constructible): Adjust. + + * testsuite/util/testsuite_tr1.h (ThrowDefaultClass, + ThrowCopyConsClass, ThrowMoveConsClass, NoexceptDefaultClass, + ExceptDefaultClass, NoexceptCopyConsClass, ExceptCopyConsClass, + NoexceptMoveConsClass, ExceptMoveConsClass): Add in C++0x mode. + + * testsuite/20_util/has_nothrow_default_constructor: Remove. + * testsuite/20_util/has_nothrow_copy_constructor: Likewise. + + * testsuite/20_util/is_nothrow_move_constructible/value.cc: Likewise. + * testsuite/20_util/is_nothrow_move_constructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_nothrow_move_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_nothrow_copy_constructible/value.cc: Likewise. + * testsuite/20_util/is_nothrow_copy_constructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_nothrow_copy_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_nothrow_default_constructible/value.cc: + Likewise. + * testsuite/20_util/is_nothrow_default_constructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_nothrow_default_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_move_constructible/value.cc: Likewise. + * testsuite/20_util/is_move_constructible/requirements/typedefs.cc: + Likewise. + * testsuite/20_util/is_move_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_copy_constructible/value.cc: Likewise. + * testsuite/20_util/is_copy_constructible/requirements/typedefs.cc: + Likewise. + * testsuite/20_util/is_copy_constructible/requirements/ + explicit_instantiation.cc: Likewise. + + * testsuite/20_util/is_default_constructible/value.cc: Add tests. + * testsuite/20_util/is_nothrow_constructible/value.cc: Likewise. + + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: + Adjust dg-error line numbers. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: + Likewise. + * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. + 2011-04-17 Paolo Carlini * testsuite/25_algorithms/partition/moveable.cc: Actually run diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index a4c7673..ef62298 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -854,27 +854,132 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Args...>::value)> { }; + template::value> + struct __is_copy_constructible_impl; - template - struct __is_nt_constructible_helper - { static const bool __value = false; }; + template + struct __is_copy_constructible_impl<_Tp, true> + : public false_type { }; + + template + struct __is_copy_constructible_impl<_Tp, false> + : public is_constructible<_Tp, const _Tp&> + { }; + + /// is_copy_constructible + template + struct is_copy_constructible + : public __is_copy_constructible_impl<_Tp> + { }; + + template::value> + struct __is_move_constructible_impl; + + template + struct __is_move_constructible_impl<_Tp, true> + : public false_type { }; + + template + struct __is_move_constructible_impl<_Tp, false> + : public is_constructible<_Tp, _Tp&&> + { }; + + /// is_move_constructible + template + struct is_move_constructible + : public __is_move_constructible_impl<_Tp> + { }; + + template + struct __is_nt_default_constructible_atom + : public integral_constant + { }; + + template::value> + struct __is_nt_default_constructible_impl; + + template + struct __is_nt_default_constructible_impl<_Tp, true> + : public __and_<__is_array_known_bounds<_Tp>, + __is_nt_default_constructible_atom::type>>::type + { }; + + template + struct __is_nt_default_constructible_impl<_Tp, false> + : public __is_nt_default_constructible_atom<_Tp> + { }; + + /// is_nothrow_default_constructible + template + struct is_nothrow_default_constructible + : public __and_, + __is_nt_default_constructible_impl<_Tp>>::type + { }; template - struct __is_nt_constructible_helper - { static const bool __value = noexcept(_Tp(declval<_Args>()...)); }; + struct __is_nt_constructible_impl + : public integral_constant()...))> + { }; template - struct __is_nt_constructible_helper - { - static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>())); - }; + struct __is_nt_constructible_impl<_Tp, _Arg> + : public integral_constant(declval<_Arg>()))> + { }; + + template + struct __is_nt_constructible_impl<_Tp> + : public is_nothrow_default_constructible<_Tp> + { }; /// is_nothrow_constructible template struct is_nothrow_constructible - : public integral_constant::value, - _Tp, _Args...>::__value> + : public __and_, + __is_nt_constructible_impl<_Tp, _Args...>>::type + { }; + + template::value> + struct __is_nothrow_copy_constructible_impl; + + template + struct __is_nothrow_copy_constructible_impl<_Tp, true> + : public false_type { }; + + template + struct __is_nothrow_copy_constructible_impl<_Tp, false> + : public is_nothrow_constructible<_Tp, const _Tp&> + { }; + + /// is_nothrow_copy_constructible + template + struct is_nothrow_copy_constructible + : public __is_nothrow_copy_constructible_impl<_Tp> + { }; + + template::value> + struct __is_nothrow_move_constructible_impl; + + template + struct __is_nothrow_move_constructible_impl<_Tp, true> + : public false_type { }; + + template + struct __is_nothrow_move_constructible_impl<_Tp, false> + : public is_nothrow_constructible<_Tp, _Tp&&> + { }; + + /// is_nothrow_move_constructible + template + struct is_nothrow_move_constructible + : public __is_nothrow_move_constructible_impl<_Tp> + { }; + + /// has_nothrow_copy_assign + template + struct has_nothrow_copy_assign + : public integral_constant { }; /// has_trivial_default_constructor @@ -901,24 +1006,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant { }; - /// has_nothrow_default_constructor - template - struct has_nothrow_default_constructor - : public integral_constant - { }; - - /// has_nothrow_copy_constructor - template - struct has_nothrow_copy_constructor - : public integral_constant - { }; - - /// has_nothrow_copy_assign - template - struct has_nothrow_copy_assign - : public integral_constant - { }; - /// has_virtual_destructor template struct has_virtual_destructor diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index aaf1fb0..6aee07a 100644 --- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-error "static assertion failed" "" { target *-*-* } 1523 } +// { dg-error "static assertion failed" "" { target *-*-* } 1610 } #include diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc deleted file mode 100644 index 7c84451..0000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc +++ /dev/null @@ -1,31 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// { dg-do compile } -// 2007-04-30 Benjamin Kosnik - -// 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 -// . - - -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -namespace std -{ - typedef short test_type; - template struct has_nothrow_copy_constructor; -} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc deleted file mode 100644 index 5c40837..0000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc +++ /dev/null @@ -1,36 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-30 Paolo Carlini -// -// Copyright (C) 2004, 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 -// . - -// -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -// { dg-do compile } - -void test01() -{ - // Check for required typedefs - typedef std::has_nothrow_copy_constructor test_type; - typedef test_type::value_type value_type; - typedef test_type::type type; - typedef test_type::type::value_type type_value_type; - typedef test_type::type::type type_type; -} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc deleted file mode 100644 index 963c7bd..0000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc +++ /dev/null @@ -1,56 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-30 Paolo Carlini -// -// Copyright (C) 2004, 2005, 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 -// . - -#include -#include -#include - -void test01() -{ - bool test __attribute__((unused)) = true; - using std::has_nothrow_copy_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - - // Negative tests. - VERIFY( (test_category(false)) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc deleted file mode 100644 index dec9b96..0000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc +++ /dev/null @@ -1,31 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// { dg-do compile } -// 2007-04-30 Benjamin Kosnik - -// 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 -// . - - -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -namespace std -{ - typedef short test_type; - template struct has_nothrow_default_constructor; -} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc deleted file mode 100644 index 709fff3..0000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc +++ /dev/null @@ -1,36 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-29 Paolo Carlini -// -// Copyright (C) 2004, 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 -// . - -// -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -// { dg-do compile } - -void test01() -{ - // Check for required typedefs - typedef std::has_nothrow_default_constructor test_type; - typedef test_type::value_type value_type; - typedef test_type::type type; - typedef test_type::type::value_type type_value_type; - typedef test_type::type::type type_type; -} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc deleted file mode 100644 index 0154821..0000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc +++ /dev/null @@ -1,61 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-29 Paolo Carlini -// -// 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 -// . - -// 4.5.3 Type properties - -#include -#include -#include - -void test01() -{ - bool test __attribute__((unused)) = true; - using std::has_nothrow_default_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - - // Negative tests. - VERIFY( (test_category(false)) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..4ff9d10 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_copy_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/typedefs.cc new file mode 100644 index 0000000..840a9f1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +void test01() +{ + // Check for required typedefs + typedef std::is_copy_constructible test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc new file mode 100644 index 0000000..d1c2ea6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_copy_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc index bd18d50..6461cb7 100644 --- a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc @@ -93,6 +93,13 @@ static_assert(std::is_default_constructible< static_assert(std::is_default_constructible[1]>::value, "Error"); +static_assert(std::is_default_constructible + <__gnu_test::NoexceptDefaultClass>::value, "Error"); +static_assert(std::is_default_constructible + <__gnu_test::ThrowDefaultClass>::value, "Error"); +static_assert(std::is_default_constructible + <__gnu_test::ExceptDefaultClass>::value, "Error"); + static_assert(!std::is_default_constructible::value, "Error"); static_assert(!std::is_default_constructible::value, "Error"); static_assert(!std::is_default_constructible::value, "Error"); diff --git a/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..2d67b20 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_move_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/typedefs.cc new file mode 100644 index 0000000..76208d8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +void test01() +{ + // Check for required typedefs + typedef std::is_move_constructible test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_move_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_move_constructible/value.cc new file mode 100644 index 0000000..623359a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_move_constructible/value.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc index b3246fa..a77fa6c 100644 --- a/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc @@ -2,7 +2,7 @@ // 2010-06-09 Paolo Carlini -// Copyright (C) 2010 Free Software Foundation, Inc. +// Copyright (C) 2010, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -43,6 +43,8 @@ void test01() VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + // Negative tests. VERIFY( (test_property(false)) ); @@ -69,6 +71,8 @@ void test01() int&>(false)) ); VERIFY( (test_property(false)) ); + + VERIFY( (test_property(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..39ab86b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik + +// Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_nothrow_copy_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc new file mode 100644 index 0000000..320010b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-30 Paolo Carlini +// +// Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::is_nothrow_copy_constructible test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/value.cc new file mode 100644 index 0000000..2c27996 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/value.cc @@ -0,0 +1,74 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-30 Paolo Carlini +// +// Copyright (C) 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_nothrow_copy_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..2c7e2df --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik + +// Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_nothrow_default_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc new file mode 100644 index 0000000..0c0fd64 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-29 Paolo Carlini +// +// Copyright (C) 2004, 2007, 2009, 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::is_nothrow_default_constructible test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/value.cc new file mode 100644 index 0000000..d806cf1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/value.cc @@ -0,0 +1,74 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-29 Paolo Carlini +// +// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2011 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_nothrow_default_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_category(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..bca081b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_nothrow_move_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc new file mode 100644 index 0000000..13a0e3e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +void test01() +{ + // Check for required typedefs + typedef std::is_nothrow_move_constructible test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/value.cc new file mode 100644 index 0000000..b154f78 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/value.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_nothrow_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_property(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index 4a568e36..871bbe5 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "instantiated from here" "" { target *-*-* } 40 } // { dg-error "instantiated from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1302 } -// { dg-error "declaration of" "" { target *-*-* } 1266 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1389 } +// { dg-error "declaration of" "" { target *-*-* } 1353 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index 955c1ce..edcce7c 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "instantiated from here" "" { target *-*-* } 40 } // { dg-error "instantiated from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1226 } -// { dg-error "declaration of" "" { target *-*-* } 1190 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1313 } +// { dg-error "declaration of" "" { target *-*-* } 1277 } diff --git a/libstdc++-v3/testsuite/util/testsuite_tr1.h b/libstdc++-v3/testsuite/util/testsuite_tr1.h index 7e36ee3..9265bc4 100644 --- a/libstdc++-v3/testsuite/util/testsuite_tr1.h +++ b/libstdc++-v3/testsuite/util/testsuite_tr1.h @@ -145,7 +145,22 @@ namespace __gnu_test ThrowExplicitClass(double&, int&, double&) throw(int); }; + struct ThrowDefaultClass + { + ThrowDefaultClass() throw(int); + }; + + struct ThrowCopyConsClass + { + ThrowCopyConsClass(const ThrowCopyConsClass&) throw(int); + }; + #ifdef __GXX_EXPERIMENTAL_CXX0X__ + struct ThrowMoveConsClass + { + ThrowMoveConsClass(ThrowMoveConsClass&&) throw(int); + }; + struct NoexceptExplicitClass { NoexceptExplicitClass(double&) noexcept(true); @@ -159,6 +174,36 @@ namespace __gnu_test explicit ExceptExplicitClass(int&) noexcept(false); ExceptExplicitClass(double&, int&, double&) noexcept(false); }; + + struct NoexceptDefaultClass + { + NoexceptDefaultClass() noexcept(true); + }; + + struct ExceptDefaultClass + { + ExceptDefaultClass() noexcept(false); + }; + + struct NoexceptCopyConsClass + { + NoexceptCopyConsClass(const NoexceptCopyConsClass&) noexcept(true); + }; + + struct ExceptCopyConsClass + { + ExceptCopyConsClass(const ExceptCopyConsClass&) noexcept(false); + }; + + struct NoexceptMoveConsClass + { + NoexceptMoveConsClass(NoexceptMoveConsClass&&) noexcept(true); + }; + + struct ExceptMoveConsClass + { + ExceptMoveConsClass(ExceptMoveConsClass&&) noexcept(false); + }; #endif struct NType // neither trivial nor standard-layout -- cgit v1.1