From 3b222acdc1558361952f6f7dc4feb5902b13f7d0 Mon Sep 17 00:00:00 2001 From: paolo Date: Sun, 15 Apr 2012 23:35:27 +0000 Subject: [PATCH] 2012-04-15 Paolo Carlini PR libstdc++/52702 * include/std/type_traits (is_trivially_destructible): Add. (has_trivial_destructor): Remove. * testsuite/util/testsuite_common_types.h: Adjust. * testsuite/20_util/tuple/requirements/dr801.cc: Likewise. * testsuite/20_util/pair/requirements/dr801.cc: Likewise. * testsuite/20_util/is_trivially_destructible/value.cc: New. * testsuite/20_util/is_trivially_destructible/requirements/ typedefs.cc: Likewise. * testsuite/20_util/is_trivially_destructible/requirements/ explicit_instantiation.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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186474 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 19 ++++++++++ libstdc++-v3/include/std/type_traits | 33 +++++++++++----- .../20_util/declval/requirements/1_neg.cc | 4 +- .../requirements/explicit_instantiation.cc | 31 +++++++++++++++ .../requirements/typedefs.cc | 37 ++++++++++++++++++ .../20_util/is_trivially_destructible/value.cc | 44 ++++++++++++++++++++++ .../make_signed/requirements/typedefs_neg.cc | 17 +++++---- .../make_unsigned/requirements/typedefs_neg.cc | 17 +++++---- .../testsuite/20_util/pair/requirements/dr801.cc | 4 +- .../testsuite/20_util/tuple/requirements/dr801.cc | 2 +- .../testsuite/util/testsuite_common_types.h | 2 +- 11 files changed, 179 insertions(+), 31 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/20_util/is_trivially_destructible/value.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 97b091a..eb010a2 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,22 @@ +2012-04-15 Paolo Carlini + + PR libstdc++/52702 + * include/std/type_traits (is_trivially_destructible): Add. + (has_trivial_destructor): Remove. + * testsuite/util/testsuite_common_types.h: Adjust. + * testsuite/20_util/tuple/requirements/dr801.cc: Likewise. + * testsuite/20_util/pair/requirements/dr801.cc: Likewise. + * testsuite/20_util/is_trivially_destructible/value.cc: New. + * testsuite/20_util/is_trivially_destructible/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_trivially_destructible/requirements/ + explicit_instantiation.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. + 2012-04-14 Paolo Carlini PR libstdc++/52699 diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 4102263..eb8c6a0 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1147,30 +1147,45 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public __is_nt_move_assignable_impl<_Tp> { }; - /// has_trivial_default_constructor + /// is_trivially_constructible (still unimplemented) + + /// is_trivially_default_constructible (still unimplemented) + + /// is_trivially_copy_constructible (still unimplemented) + + /// is_trivially_move_constructible (still unimplemented) + + /// is_trivially_assignable (still unimplemented) + + /// is_trivially_copy_assignable (still unimplemented) + + /// is_trivially_move_assignable (still unimplemented) + + /// is_trivially_destructible + template + struct is_trivially_destructible + : public __and_, integral_constant>::type + { }; + + /// has_trivial_default_constructor (temporary legacy) template struct has_trivial_default_constructor : public integral_constant { }; - /// has_trivial_copy_constructor + /// has_trivial_copy_constructor (temporary legacy) template struct has_trivial_copy_constructor : public integral_constant { }; - /// has_trivial_copy_assign + /// has_trivial_copy_assign (temporary legacy) template struct has_trivial_copy_assign : public integral_constant { }; - /// has_trivial_destructor - template - struct has_trivial_destructor - : public integral_constant - { }; - /// has_virtual_destructor template struct has_virtual_destructor diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index eafbe5f..9715419 100644 --- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -2,7 +2,7 @@ // { dg-do compile } // 2009-11-12 Paolo Carlini // -// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010, 2011, 2012 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,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-error "static assertion failed" "" { target *-*-* } 1777 } +// { dg-error "static assertion failed" "" { target *-*-* } 1792 } #include diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..c6ab0b2 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/explicit_instantiation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2012-04-15 Paolo Carlini +// +// Copyright (C) 2012 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_destructible; +} diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/typedefs.cc new file mode 100644 index 0000000..66b3f7b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++11" } +// +// 2012-04-15 Paolo Carlini +// +// Copyright (C) 2012 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_destructible 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_destructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_destructible/value.cc new file mode 100644 index 0000000..cfba8ae --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_destructible/value.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++11" } +// +// 2012-04-15 Paolo Carlini +// +// Copyright (C) 2012 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_trivially_destructible; + using namespace __gnu_test; + + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_category(false)) ); + VERIFY( (test_category(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 6358d72..80739a3 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 @@ -3,7 +3,8 @@ // 2007-05-03 Benjamin Kosnik // -// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 +// 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 @@ -42,11 +43,11 @@ void test01() typedef make_signed::type test5_type; } -// { dg-error "does not name a type" "" { target *-*-* } 33 } -// { dg-error "required from here" "" { target *-*-* } 35 } -// { dg-error "required from here" "" { target *-*-* } 37 } -// { dg-error "required from here" "" { target *-*-* } 40 } -// { dg-error "required from here" "" { target *-*-* } 42 } +// { dg-error "does not name a type" "" { target *-*-* } 34 } +// { dg-error "required from here" "" { target *-*-* } 36 } +// { dg-error "required from here" "" { target *-*-* } 38 } +// { dg-error "required from here" "" { target *-*-* } 41 } +// { dg-error "required from here" "" { target *-*-* } 43 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1566 } -// { dg-error "declaration of" "" { target *-*-* } 1530 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1581 } +// { dg-error "declaration of" "" { target *-*-* } 1545 } 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 d9a0f17..124693d 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 @@ -3,7 +3,8 @@ // 2007-05-03 Benjamin Kosnik // -// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 +// 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 @@ -42,11 +43,11 @@ void test01() typedef make_unsigned::type test5_type; } -// { dg-error "does not name a type" "" { target *-*-* } 33 } -// { dg-error "required from here" "" { target *-*-* } 35 } -// { dg-error "required from here" "" { target *-*-* } 37 } -// { dg-error "required from here" "" { target *-*-* } 40 } -// { dg-error "required from here" "" { target *-*-* } 42 } +// { dg-error "does not name a type" "" { target *-*-* } 34 } +// { dg-error "required from here" "" { target *-*-* } 36 } +// { dg-error "required from here" "" { target *-*-* } 38 } +// { dg-error "required from here" "" { target *-*-* } 41 } +// { dg-error "required from here" "" { target *-*-* } 43 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1484 } -// { dg-error "declaration of" "" { target *-*-* } 1448 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1499 } +// { dg-error "declaration of" "" { target *-*-* } 1463 } diff --git a/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc index 36d380d..e7d6626 100644 --- a/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc +++ b/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// Copyright (C) 2010 Free Software Foundation, Inc. +// Copyright (C) 2010, 2012 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 @@ -29,7 +29,7 @@ void test_trivial() // static_assert(std::is_literal_type::value, "! literal"); static_assert(std::has_trivial_copy_constructor::value, "! triv copy"); - static_assert(std::has_trivial_destructor::value, + static_assert(std::is_trivially_destructible::value, "! triv destructor"); // static_assert(std::is_standard_layout::value, // "! standard layout"); diff --git a/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc index fd21b9e..879bfd1 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc @@ -29,7 +29,7 @@ void test_trivial() // static_assert(std::is_literal_type::value, "! literal"); static_assert(std::has_trivial_copy_constructor::value, "! triv copy"); - static_assert(std::has_trivial_destructor::value, + static_assert(std::is_trivially_destructible::value, "! triv destructor"); // static_assert(std::is_standard_layout::value, // "! standard layout"); diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h index 03be0ac..c9be94d 100644 --- a/libstdc++-v3/testsuite/util/testsuite_common_types.h +++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h @@ -549,7 +549,7 @@ namespace __gnu_test typedef std::has_trivial_default_constructor<_Tp> ctor_p; static_assert(ctor_p::value, "default constructor not trivial"); - typedef std::has_trivial_destructor<_Tp> dtor_p; + typedef std::is_trivially_destructible<_Tp> dtor_p; static_assert(dtor_p::value, "destructor not trivial"); } }; -- 2.7.4