diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2011-04-19 00:10:53 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-04-19 00:10:53 +0000 |
commit | 65cee9bdb7b5975151802bd805ba720f540dec8d (patch) | |
tree | facddf3c84a29435c4341358f41cf948bd528d8e | |
parent | 1c13f168fd22cab61279e25df480b91f44a08b5e (diff) | |
download | gcc-65cee9bdb7b5975151802bd805ba720f540dec8d.zip gcc-65cee9bdb7b5975151802bd805ba720f540dec8d.tar.gz gcc-65cee9bdb7b5975151802bd805ba720f540dec8d.tar.bz2 |
type_traits (is_nothrow_default_constructible, [...]): Add.
2011-04-18 Paolo Carlini <paolo.carlini@oracle.com>
* 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
25 files changed, 804 insertions, 171 deletions
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 <paolo.carlini@oracle.com> + + * 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 <paolo.carlini@oracle.com> * 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<typename _Tp, bool = is_void<_Tp>::value> + struct __is_copy_constructible_impl; - template<bool, typename _Tp, typename... _Args> - struct __is_nt_constructible_helper - { static const bool __value = false; }; + template<typename _Tp> + struct __is_copy_constructible_impl<_Tp, true> + : public false_type { }; + + template<typename _Tp> + struct __is_copy_constructible_impl<_Tp, false> + : public is_constructible<_Tp, const _Tp&> + { }; + + /// is_copy_constructible + template<typename _Tp> + struct is_copy_constructible + : public __is_copy_constructible_impl<_Tp> + { }; + + template<typename _Tp, bool = is_void<_Tp>::value> + struct __is_move_constructible_impl; + + template<typename _Tp> + struct __is_move_constructible_impl<_Tp, true> + : public false_type { }; + + template<typename _Tp> + struct __is_move_constructible_impl<_Tp, false> + : public is_constructible<_Tp, _Tp&&> + { }; + + /// is_move_constructible + template<typename _Tp> + struct is_move_constructible + : public __is_move_constructible_impl<_Tp> + { }; + + template<typename _Tp> + struct __is_nt_default_constructible_atom + : public integral_constant<bool, noexcept(_Tp())> + { }; + + template<typename _Tp, bool = is_array<_Tp>::value> + struct __is_nt_default_constructible_impl; + + template<typename _Tp> + struct __is_nt_default_constructible_impl<_Tp, true> + : public __and_<__is_array_known_bounds<_Tp>, + __is_nt_default_constructible_atom<typename + remove_all_extents<_Tp>::type>>::type + { }; + + template<typename _Tp> + struct __is_nt_default_constructible_impl<_Tp, false> + : public __is_nt_default_constructible_atom<_Tp> + { }; + + /// is_nothrow_default_constructible + template<typename _Tp> + struct is_nothrow_default_constructible + : public __and_<is_default_constructible<_Tp>, + __is_nt_default_constructible_impl<_Tp>>::type + { }; template<typename _Tp, typename... _Args> - struct __is_nt_constructible_helper<true, _Tp, _Args...> - { static const bool __value = noexcept(_Tp(declval<_Args>()...)); }; + struct __is_nt_constructible_impl + : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> + { }; template<typename _Tp, typename _Arg> - struct __is_nt_constructible_helper<true, _Tp, _Arg> - { - static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>())); - }; + struct __is_nt_constructible_impl<_Tp, _Arg> + : public integral_constant<bool, + noexcept(static_cast<_Tp>(declval<_Arg>()))> + { }; + + template<typename _Tp> + struct __is_nt_constructible_impl<_Tp> + : public is_nothrow_default_constructible<_Tp> + { }; /// is_nothrow_constructible template<typename _Tp, typename... _Args> struct is_nothrow_constructible - : public integral_constant<bool, - __is_nt_constructible_helper<is_constructible<_Tp, _Args...>::value, - _Tp, _Args...>::__value> + : public __and_<is_constructible<_Tp, _Args...>, + __is_nt_constructible_impl<_Tp, _Args...>>::type + { }; + + template<typename _Tp, bool = is_void<_Tp>::value> + struct __is_nothrow_copy_constructible_impl; + + template<typename _Tp> + struct __is_nothrow_copy_constructible_impl<_Tp, true> + : public false_type { }; + + template<typename _Tp> + struct __is_nothrow_copy_constructible_impl<_Tp, false> + : public is_nothrow_constructible<_Tp, const _Tp&> + { }; + + /// is_nothrow_copy_constructible + template<typename _Tp> + struct is_nothrow_copy_constructible + : public __is_nothrow_copy_constructible_impl<_Tp> + { }; + + template<typename _Tp, bool = is_void<_Tp>::value> + struct __is_nothrow_move_constructible_impl; + + template<typename _Tp> + struct __is_nothrow_move_constructible_impl<_Tp, true> + : public false_type { }; + + template<typename _Tp> + struct __is_nothrow_move_constructible_impl<_Tp, false> + : public is_nothrow_constructible<_Tp, _Tp&&> + { }; + + /// is_nothrow_move_constructible + template<typename _Tp> + struct is_nothrow_move_constructible + : public __is_nothrow_move_constructible_impl<_Tp> + { }; + + /// has_nothrow_copy_assign + template<typename _Tp> + struct has_nothrow_copy_assign + : public integral_constant<bool, __has_nothrow_assign(_Tp)> { }; /// has_trivial_default_constructor @@ -901,24 +1006,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, __has_trivial_destructor(_Tp)> { }; - /// has_nothrow_default_constructor - template<typename _Tp> - struct has_nothrow_default_constructor - : public integral_constant<bool, __has_nothrow_constructor(_Tp)> - { }; - - /// has_nothrow_copy_constructor - template<typename _Tp> - struct has_nothrow_copy_constructor - : public integral_constant<bool, __has_nothrow_copy(_Tp)> - { }; - - /// has_nothrow_copy_assign - template<typename _Tp> - struct has_nothrow_copy_assign - : public integral_constant<bool, __has_nothrow_assign(_Tp)> - { }; - /// has_virtual_destructor template<typename _Tp> 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 // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 1523 } +// { dg-error "static assertion failed" "" { target *-*-* } 1610 } #include <utility> 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 <pcarlini@suse.de> -// -// 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 -// <http://www.gnu.org/licenses/>. - -#include <type_traits> -#include <testsuite_hooks.h> -#include <testsuite_tr1.h> - -void test01() -{ - bool test __attribute__((unused)) = true; - using std::has_nothrow_copy_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category<has_nothrow_copy_constructor, int>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, float>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, EnumType>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int*>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int(*)(int)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*) (int)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int[2]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, float[][3]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, EnumType[2][3][4]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int*[3]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int(*[][2])(int)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*[2][3])>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, - int (ClassType::*[][2][3]) (int)>(true)) ); - - // Negative tests. - VERIFY( (test_category<has_nothrow_copy_constructor, void>(false)) ); -} - -int main() -{ - test01(); - return 0; -} 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 <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 <type_traits> -#include <testsuite_hooks.h> -#include <testsuite_tr1.h> - -void test01() -{ - bool test __attribute__((unused)) = true; - using std::has_nothrow_default_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category<has_nothrow_default_constructor, int>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, float>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, EnumType>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int*>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int(*)(int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int (ClassType::*)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, - int (ClassType::*) (int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int[2]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, float[][3]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, EnumType[2][3][4]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int*[3]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int(*[][2])(int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, - int (ClassType::*[2][3])>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, - int (ClassType::*[][2][3]) (int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, ClassType>(true)) ); - - // Negative tests. - VERIFY( (test_category<has_nothrow_default_constructor, void>(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 +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_copy_constructible<test_type>; +} 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 +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_copy_constructible<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_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 +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_copy_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_copy_constructible, int>(true)) ); + VERIFY( (test_category<is_copy_constructible, float>(true)) ); + VERIFY( (test_category<is_copy_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_copy_constructible, int*>(true)) ); + VERIFY( (test_category<is_copy_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_copy_constructible, + NoexceptCopyConsClass>(true)) ); + VERIFY( (test_property<is_copy_constructible, + const NoexceptCopyConsClass>(true)) ); + VERIFY( (test_property<is_copy_constructible, + ThrowCopyConsClass>(true)) ); + VERIFY( (test_property<is_copy_constructible, + ExceptCopyConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_copy_constructible, void>(false)) ); + VERIFY( (test_category<is_copy_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_copy_constructible, int[]>(false)) ); + VERIFY( (test_category<is_copy_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_copy_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_copy_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_copy_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_copy_constructible, + volatile NoexceptCopyConsClass>(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<const std::initializer_list<int>[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<void>::value, "Error"); static_assert(!std::is_default_constructible<const void>::value, "Error"); static_assert(!std::is_default_constructible<Abstract>::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 +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_move_constructible<test_type>; +} 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 +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_move_constructible<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_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 +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_move_constructible, int>(true)) ); + VERIFY( (test_category<is_move_constructible, float>(true)) ); + VERIFY( (test_category<is_move_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_move_constructible, int*>(true)) ); + VERIFY( (test_category<is_move_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_move_constructible, + NoexceptMoveConsClass>(true)) ); + VERIFY( (test_property<is_move_constructible, + ThrowMoveConsClass>(true)) ); + VERIFY( (test_property<is_move_constructible, + ExceptMoveConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_move_constructible, void>(false)) ); + VERIFY( (test_category<is_move_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_move_constructible, int[]>(false)) ); + VERIFY( (test_category<is_move_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_move_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_move_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_move_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_move_constructible, + const NoexceptMoveConsClass>(false)) ); + VERIFY( (test_property<is_move_constructible, + volatile NoexceptMoveConsClass>(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 <paolo.carlini@oracle.com> -// 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<is_nothrow_constructible, NothrowExplicitClass, double&, int&, double&>(true)) ); + VERIFY( (test_property<is_nothrow_constructible, int[1]>(true)) ); + // Negative tests. VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass, void*>(false)) ); @@ -69,6 +71,8 @@ void test01() int&>(false)) ); VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass, double&, int&, double&>(false)) ); + + VERIFY( (test_property<is_nothrow_constructible, int[]>(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc index 7c84451..39ab86b 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc @@ -2,7 +2,7 @@ // { dg-do compile } // 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// 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 @@ -19,7 +19,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - // NB: This file is for testing type_traits with NO OTHER INCLUDES. #include <type_traits> @@ -27,5 +26,5 @@ namespace std { typedef short test_type; - template struct has_nothrow_copy_constructor<test_type>; + template struct is_nothrow_copy_constructible<test_type>; } diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc index 5c40837..320010b 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2004-12-30 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. +// 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 @@ -28,9 +28,9 @@ void test01() { // Check for required typedefs - typedef std::has_nothrow_copy_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; + typedef std::is_nothrow_copy_constructible<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; } diff --git a/libstdc++-v3/testsuite/20_util/is_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 <pcarlini@suse.de> +// +// 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 +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_nothrow_copy_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_nothrow_copy_constructible, int>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, float>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int*>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_nothrow_copy_constructible, + NoexceptCopyConsClass>(true)) ); + VERIFY( (test_property<is_nothrow_copy_constructible, + const NoexceptCopyConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_nothrow_copy_constructible, void>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int[]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_nothrow_copy_constructible, + volatile NoexceptCopyConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_copy_constructible, + ThrowCopyConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_copy_constructible, + ExceptCopyConsClass>(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/is_nothrow_default_constructible/requirements/explicit_instantiation.cc index dec9b96..2c7e2df 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc @@ -2,7 +2,7 @@ // { dg-do compile } // 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// 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 @@ -19,7 +19,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - // NB: This file is for testing type_traits with NO OTHER INCLUDES. #include <type_traits> @@ -27,5 +26,5 @@ namespace std { typedef short test_type; - template struct has_nothrow_default_constructor<test_type>; + template struct is_nothrow_default_constructible<test_type>; } diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc index 709fff3..0c0fd64 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2004-12-29 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. +// 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 @@ -28,9 +28,9 @@ void test01() { // Check for required typedefs - typedef std::has_nothrow_default_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; + typedef std::is_nothrow_default_constructible<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; } diff --git a/libstdc++-v3/testsuite/20_util/is_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 <pcarlini@suse.de> +// +// 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 +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_nothrow_default_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_nothrow_default_constructible, int>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, float>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int*>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int(*)(int)>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int[2]>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int*[3]>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, ClassType>(true)) ); + + VERIFY( (test_category<is_nothrow_default_constructible, + NoexceptDefaultClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_nothrow_default_constructible, void>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int[]>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + float[][3]>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_category<is_nothrow_default_constructible, + ThrowDefaultClass>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + ExceptDefaultClass>(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 +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_nothrow_move_constructible<test_type>; +} 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 +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_nothrow_move_constructible<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_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 +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_nothrow_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_nothrow_move_constructible, int>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, float>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int*>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_nothrow_move_constructible, + NoexceptMoveConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_nothrow_move_constructible, void>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int[]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_nothrow_move_constructible, + const NoexceptMoveConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_move_constructible, + volatile NoexceptMoveConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_move_constructible, + ThrowMoveConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_move_constructible, + ExceptMoveConsClass>(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 |