2012-04-15 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 15 Apr 2012 23:35:27 +0000 (23:35 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 15 Apr 2012 23:35:27 +0000 (23:35 +0000)
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
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_trivially_destructible/value.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc
libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc
libstdc++-v3/testsuite/util/testsuite_common_types.h

index 97b091a..eb010a2 100644 (file)
@@ -1,3 +1,22 @@
+2012-04-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       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  <paolo.carlini@oracle.com>
 
        PR libstdc++/52699
index 4102263..eb8c6a0 100644 (file)
@@ -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<typename _Tp>
+    struct is_trivially_destructible
+    : public __and_<is_destructible<_Tp>, integral_constant<bool,
+                             __has_trivial_destructor(_Tp)>>::type
+    { };
+
+  /// has_trivial_default_constructor (temporary legacy)
   template<typename _Tp>
     struct has_trivial_default_constructor
     : public integral_constant<bool, __has_trivial_constructor(_Tp)>
     { };
 
-  /// has_trivial_copy_constructor
+  /// has_trivial_copy_constructor (temporary legacy)
   template<typename _Tp>
     struct has_trivial_copy_constructor
     : public integral_constant<bool, __has_trivial_copy(_Tp)>
     { };
 
-  /// has_trivial_copy_assign
+  /// has_trivial_copy_assign (temporary legacy)
   template<typename _Tp>
     struct has_trivial_copy_assign
     : public integral_constant<bool, __has_trivial_assign(_Tp)>
     { };
 
-  /// has_trivial_destructor
-  template<typename _Tp>
-    struct has_trivial_destructor
-    : public integral_constant<bool, __has_trivial_destructor(_Tp)>
-    { };
-
   /// has_virtual_destructor
   template<typename _Tp>
     struct has_virtual_destructor
index eafbe5f..9715419 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do compile }
 // 2009-11-12  Paolo Carlini  <paolo.carlini@oracle.com>
 //
-// 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
 // <http://www.gnu.org/licenses/>.
 
-// { dg-error "static assertion failed" "" { target *-*-* } 1777 }
+// { dg-error "static assertion failed" "" { target *-*-* } 1792 }
 
 #include <utility>
 
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 (file)
index 0000000..c6ab0b2
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+//
+// 2012-04-15  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// 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
+// <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_trivially_destructible<test_type>;
+}
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 (file)
index 0000000..66b3f7b
--- /dev/null
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++11" }
+//
+// 2012-04-15  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::is_trivially_destructible<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_trivially_destructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_destructible/value.cc
new file mode 100644 (file)
index 0000000..cfba8ae
--- /dev/null
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++11" }
+//
+// 2012-04-15  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// 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
+// <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_trivially_destructible;
+  using namespace __gnu_test;
+
+  VERIFY( (test_category<is_trivially_destructible, int>(true)) );
+  VERIFY( (test_category<is_trivially_destructible, TType>(true)) );
+  VERIFY( (test_category<is_trivially_destructible, PODType>(true)) );
+
+  VERIFY( (test_category<is_trivially_destructible, NType>(false)) );
+  VERIFY( (test_category<is_trivially_destructible, SLType>(false)) );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
index 6358d72..80739a3 100644 (file)
@@ -3,7 +3,8 @@
 
 // 2007-05-03  Benjamin Kosnik  <bkoz@redhat.com>
 //
-// 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<float>::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 }
index d9a0f17..124693d 100644 (file)
@@ -3,7 +3,8 @@
 
 // 2007-05-03  Benjamin Kosnik  <bkoz@redhat.com>
 //
-// 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<float>::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 }
index 36d380d..e7d6626 100644 (file)
@@ -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<pair_type>::value, "! literal");
   static_assert(std::has_trivial_copy_constructor<pair_type>::value,
                "! triv copy");
-  static_assert(std::has_trivial_destructor<pair_type>::value,
+  static_assert(std::is_trivially_destructible<pair_type>::value,
                "! triv destructor");
   // static_assert(std::is_standard_layout<pair_type>::value,
   //               "! standard layout");
index fd21b9e..879bfd1 100644 (file)
@@ -29,7 +29,7 @@ void test_trivial()
   // static_assert(std::is_literal_type<tuple_type>::value, "! literal");
   static_assert(std::has_trivial_copy_constructor<tuple_type>::value,
                "! triv copy");
-  static_assert(std::has_trivial_destructor<tuple_type>::value,
+  static_assert(std::is_trivially_destructible<tuple_type>::value,
                "! triv destructor");
   // static_assert(std::is_standard_layout<tuple_type>::value,
   //              "! standard layout");
index 03be0ac..c9be94d 100644 (file)
@@ -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");
          }
        };