summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-15 23:35:27 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-15 23:35:27 +0000
commit3b222acdc1558361952f6f7dc4feb5902b13f7d0 (patch)
tree0be0497b23b1290a05f246b7d8c32bf1b362f7f2
parentfbcdace88924f69b64ab330ac412cf9b381b2f72 (diff)
downloadppe42-gcc-3b222acdc1558361952f6f7dc4feb5902b13f7d0.tar.gz
ppe42-gcc-3b222acdc1558361952f6f7dc4feb5902b13f7d0.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186474 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog19
-rw-r--r--libstdc++-v3/include/std/type_traits33
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/explicit_instantiation.cc31
-rw-r--r--libstdc++-v3/testsuite/20_util/is_trivially_destructible/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/20_util/is_trivially_destructible/value.cc44
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc17
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc17
-rw-r--r--libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc2
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_common_types.h2
11 files changed, 179 insertions, 31 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 97b091a52d4..eb010a22d77 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 41022630837..eb8c6a06fe9 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<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
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 eafbe5f6666..9715419c092 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 <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
index 00000000000..c6ab0b2c54e
--- /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 <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
index 00000000000..66b3f7bd920
--- /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 <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
index 00000000000..cfba8aeba9e
--- /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 <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;
+}
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 6358d72c4a5..80739a3e452 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 <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 }
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 d9a0f178f6c..124693d433c 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 <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 }
diff --git a/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc
index 36d380dcf87..e7d6626becd 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<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");
diff --git a/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc
index fd21b9ee5c5..879bfd126bb 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<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");
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
index 03be0acac25..c9be94d8f21 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");
}
};
OpenPOWER on IntegriCloud