From f5e523b76d1bdaf0df15f6bfdee602a3e153be68 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Thu, 9 Oct 2014 11:37:26 +0300 Subject: [PATCH] re PR libstdc++/60132 (C++11: lack of is_trivially_copy_constructible) 2014-10-09 Ville Voutilainen PR libstdc++/60132 * include/std/type_traits (is_trivially_copyable, is_trivially_constructible, is_trivially_default_constructible, is_trivially_copy_constructible, is_trivially_move_constructible, is_trivially_assignable, is_trivially_copy_assignable, is_trivially_move_assignable): New. * testsuite/20_util/is_trivially_assignable/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_assignable/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_assignable/value.cc: Likewise. * testsuite/20_util/is_trivially_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_constructible/value.cc: Likewise. * testsuite/20_util/is_trivially_copyable/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_copyable/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_copyable/value.cc: Likewise. * testsuite/20_util/is_trivially_copy_assignable/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_copy_assignable/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_copy_assignable/value.cc: Likewise. * testsuite/20_util/is_trivially_copy_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_copy_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_copy_constructible/value.cc: Likewise. * testsuite/20_util/is_trivially_default_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_default_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_default_constructible/ value.cc: Likewise. * testsuite/20_util/is_trivially_move_assignable/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_move_assignable/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_move_assignable/value.cc: Likewise. * testsuite/20_util/is_trivially_move_constructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_move_constructible/requirements/ explicit_instantiation.cc: Likewise. * testsuite/20_util/is_trivially_move_constructible/value.cc: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error line number. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. From-SVN: r216032 --- libstdc++-v3/ChangeLog | 57 ++++++ libstdc++-v3/include/std/type_traits | 61 ++++++- .../20_util/declval/requirements/1_neg.cc | 2 +- .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../20_util/is_trivially_assignable/value.cc | 135 ++++++++++++++ .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../is_trivially_constructible/value.cc | 168 ++++++++++++++++++ .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../is_trivially_copy_assignable/value.cc | 92 ++++++++++ .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../is_trivially_copy_constructible/value.cc | 86 +++++++++ .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../20_util/is_trivially_copyable/value.cc | 86 +++++++++ .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../value.cc | 66 +++++++ .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../is_trivially_move_assignable/value.cc | 92 ++++++++++ .../requirements/explicit_instantiation.cc | 31 ++++ .../requirements/typedefs.cc | 37 ++++ .../is_trivially_move_constructible/value.cc | 86 +++++++++ .../make_signed/requirements/typedefs_neg.cc | 4 +- .../requirements/typedefs_neg.cc | 4 +- 29 files changed, 1469 insertions(+), 14 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_assignable/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/value.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/value.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index da92622d7b9..89309fdb19f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,60 @@ +2014-10-09 Ville Voutilainen + + PR libstdc++/60132 + * include/std/type_traits (is_trivially_copyable, + is_trivially_constructible, is_trivially_default_constructible, + is_trivially_copy_constructible, is_trivially_move_constructible, + is_trivially_assignable, is_trivially_copy_assignable, + is_trivially_move_assignable): New. + * testsuite/20_util/is_trivially_assignable/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_assignable/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_assignable/value.cc: Likewise. + * testsuite/20_util/is_trivially_constructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_constructible/value.cc: Likewise. + * testsuite/20_util/is_trivially_copyable/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_copyable/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_copyable/value.cc: Likewise. + * testsuite/20_util/is_trivially_copy_assignable/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_copy_assignable/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_copy_assignable/value.cc: Likewise. + * testsuite/20_util/is_trivially_copy_constructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_copy_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_copy_constructible/value.cc: Likewise. + * testsuite/20_util/is_trivially_default_constructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_default_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_default_constructible/ + value.cc: Likewise. + * testsuite/20_util/is_trivially_move_assignable/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_move_assignable/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_move_assignable/value.cc: Likewise. + * testsuite/20_util/is_trivially_move_constructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_move_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_trivially_move_constructible/value.cc: + Likewise. + * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error + line number. + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: + Likewise. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: + Likewise. + 2014-10-08 Jonathan Wakely * include/bits/locale_facets.tcc (num_put::_M_insert_float): Do not diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 66900449b9a..d776efeb68d 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -606,7 +606,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant { }; - // is_trivially_copyable (still unimplemented) + // is_trivially_copyable + template + struct is_trivially_copyable + : public integral_constant + { }; /// is_standard_layout template @@ -1282,19 +1286,58 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public __is_nt_move_assignable_impl<_Tp> { }; - /// is_trivially_constructible (still unimplemented) + /// is_trivially_constructible + template + struct is_trivially_constructible + : public __and_, integral_constant>::type + { }; - /// is_trivially_default_constructible (still unimplemented) - - /// is_trivially_copy_constructible (still unimplemented) + /// is_trivially_default_constructible + template + struct is_trivially_default_constructible + : public is_trivially_constructible<_Tp>::type + { }; - /// is_trivially_move_constructible (still unimplemented) + /// is_trivially_copy_constructible + template + struct is_trivially_copy_constructible + : public __and_, + integral_constant>::type + { }; + + /// is_trivially_move_constructible + template + struct is_trivially_move_constructible + : public __and_, + integral_constant>::type + { }; - /// is_trivially_assignable (still unimplemented) + /// is_trivially_assignable + template + struct is_trivially_assignable + : public __and_, + integral_constant>::type + { }; - /// is_trivially_copy_assignable (still unimplemented) + /// is_trivially_copy_assignable + template + struct is_trivially_copy_assignable + : public __and_, + integral_constant>::type + { }; - /// is_trivially_move_assignable (still unimplemented) + /// is_trivially_move_assignable + template + struct is_trivially_move_assignable + : public __and_, + integral_constant>::type + { }; /// is_trivially_destructible template 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 2d03f4f68db..fe7305c040d 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 *-*-* } 2099 } +// { dg-error "static assertion failed" "" { target *-*-* } 2142 } #include diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1c5b8038481 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_assignable; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/typedefs.cc new file mode 100644 index 00000000000..517b4f03432 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_assignable 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_trivially_assignable/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/value.cc new file mode 100644 index 00000000000..27fa643d921 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_assignable/value.cc @@ -0,0 +1,135 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCAssign +{ + HasTemplateCAssign& operator=(const HasTemplateCAssign&) = default; + template + HasTemplateCAssign& operator=(T&&); +}; + +struct MoveOnly +{ + MoveOnly& operator=(MoveOnly&&) = default; +}; + +struct MoveOnly2 +{ + MoveOnly2& operator=(MoveOnly2&&) = delete; +}; + +void test01() +{ + using std::is_trivially_assignable; + using namespace __gnu_test; + + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..e7cff0f4d90 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/typedefs.cc new file mode 100644 index 00000000000..85ba7f67aa8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_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_trivially_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc new file mode 100644 index 00000000000..84fae3d81a7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_constructible/value.cc @@ -0,0 +1,168 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCCtor +{ + HasTemplateCCtor(const HasTemplateCCtor&) = default; + template + HasTemplateCCtor(T&&); +}; + +struct MoveOnly +{ + MoveOnly(MoveOnly&&) = default; +}; + +struct MoveOnly2 +{ + MoveOnly2(MoveOnly2&&) = delete; +}; + +void test01() +{ + using std::is_trivially_constructible; + using namespace __gnu_test; + + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + + +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..3d7dce96ef6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_copy_assignable; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/typedefs.cc new file mode 100644 index 00000000000..2544dd59411 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_copy_assignable 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_trivially_copy_assignable/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/value.cc new file mode 100644 index 00000000000..10e6198d9e2 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copy_assignable/value.cc @@ -0,0 +1,92 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCAssign +{ + HasTemplateCAssign& operator=(const HasTemplateCAssign&) = default; + template + HasTemplateCAssign& operator=(T&&); +}; + +struct MoveOnly +{ + MoveOnly& operator=(MoveOnly&&) = default; +}; + +struct MoveOnly2 +{ + MoveOnly2& operator=(MoveOnly2&&) = delete; +}; + +void test01() +{ + using std::is_trivially_copy_assignable; + using namespace __gnu_test; + + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..11b76afc544 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_copy_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/typedefs.cc new file mode 100644 index 00000000000..477488d3d2e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_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_trivially_copy_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/value.cc new file mode 100644 index 00000000000..18221062cef --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copy_constructible/value.cc @@ -0,0 +1,86 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCCtor +{ + HasTemplateCCtor(const HasTemplateCCtor&) = default; + template + HasTemplateCCtor(T&&); +}; + +struct MoveOnly +{ + MoveOnly(MoveOnly&&) = default; +}; + +struct MoveOnly2 +{ + MoveOnly2(MoveOnly2&&) = delete; +}; + +void test01() +{ + using std::is_trivially_copy_constructible; + using namespace __gnu_test; + + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..1e3e52b437c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_copyable; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/typedefs.cc new file mode 100644 index 00000000000..01f3a0412d1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_copyable 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_trivially_copyable/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc new file mode 100644 index 00000000000..c21a5c46772 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc @@ -0,0 +1,86 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCCtor +{ + HasTemplateCCtor(const HasTemplateCCtor&) = default; + template + HasTemplateCCtor(T&&); +}; + +struct MoveOnly +{ + MoveOnly(MoveOnly&&) = default; +}; + +struct MoveOnly2 +{ + MoveOnly2(MoveOnly2&&) = delete; +}; + +void test01() +{ + using std::is_trivially_copyable; + using namespace __gnu_test; + + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..fcfeef3efc8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_default_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/typedefs.cc new file mode 100644 index 00000000000..cc005c23c55 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_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_trivially_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc new file mode 100644 index 00000000000..e785363b94f --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc @@ -0,0 +1,66 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCtor +{ + HasTemplateCtor() = default; + template + HasTemplateCtor(); +}; + +void test01() +{ + using std::is_trivially_default_constructible; + using namespace __gnu_test; + + static_assert(test_category(true), ""); + static_assert(test_category(true), ""); + static_assert(test_category(true), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(true), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..c2b6e839302 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_move_assignable; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/typedefs.cc new file mode 100644 index 00000000000..5943b86fa9d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_move_assignable 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_trivially_move_assignable/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/value.cc new file mode 100644 index 00000000000..f96a1678bd7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/value.cc @@ -0,0 +1,92 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCAssign +{ + HasTemplateCAssign& operator=(const HasTemplateCAssign&) = default; + template + HasTemplateCAssign& operator=(T&&); +}; + +struct MoveOnly +{ + MoveOnly& operator=(MoveOnly&&) = default; +}; + +struct MoveOnly2 +{ + MoveOnly2& operator=(MoveOnly2&&) = delete; +}; + +void test01() +{ + using std::is_trivially_move_assignable; + using namespace __gnu_test; + + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..5d2b1354d69 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_move_constructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/typedefs.cc new file mode 100644 index 00000000000..f9baae1b8e6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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_trivially_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_trivially_move_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/value.cc new file mode 100644 index 00000000000..da6493eb1c9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_move_constructible/value.cc @@ -0,0 +1,86 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-10-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +struct HasTemplateCCtor +{ + HasTemplateCCtor(const HasTemplateCCtor&) = default; + template + HasTemplateCCtor(T&&); +}; + +struct MoveOnly +{ + MoveOnly(MoveOnly&&) = default; +}; + +struct MoveOnly2 +{ + MoveOnly2(MoveOnly2&&) = delete; +}; + +void test01() +{ + using std::is_trivially_move_constructible; + using namespace __gnu_test; + + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); + static_assert(test_property(true), ""); + static_assert(test_property(false), ""); +} 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 eaad899b05f..28ee98a3e1a 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 "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1764 } -// { dg-error "declaration of" "" { target *-*-* } 1728 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1807 } +// { dg-error "declaration of" "" { target *-*-* } 1771 } 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 40811a858b7..3fc1874027f 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 "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1667 } -// { dg-error "declaration of" "" { target *-*-* } 1631 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1710 } +// { dg-error "declaration of" "" { target *-*-* } 1674 } -- 2.30.2