[gcc/devel/gccgo] libstdc++: Implementing P0767 - deprecate POD
Ian Lance Taylor
ian@gcc.gnu.org
Thu Jan 23 00:10:00 GMT 2020
https://gcc.gnu.org/g:1a6c5064f920adec998932f66955c74fbfd1fa09
commit 1a6c5064f920adec998932f66955c74fbfd1fa09
Author: JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com>
Date: Thu Jan 9 21:31:43 2020 +0000
libstdc++: Implementing P0767 - deprecate POD
This adds the deprecated attribute to std::is_pod and std::is_pod_v for
C++20.
2019-12-05 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com>
* include/bits/c++config (_GLIBCXX20_DEPRECATED): Add new macro.
* include/std/type_traits (is_pod, is_pod_v): Deprecate for C++20.
* testuite/20_util/is_pod/deprecated-2a.cc: New test.
From-SVN: r280065
Diff:
---
libstdc++-v3/ChangeLog | 6 +++++
libstdc++-v3/include/bits/c++config | 7 ++++++
libstdc++-v3/include/std/type_traits | 7 ++++--
.../testsuite/20_util/is_pod/deprecated-2a.cc | 26 ++++++++++++++++++++++
4 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index c4a98f8..5725771 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-09 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com>
+
+ * include/bits/c++config (_GLIBCXX20_DEPRECATED): Add new macro.
+ * include/std/type_traits (is_pod, is_pod_v): Deprecate for C++20.
+ * testuite/20_util/is_pod/deprecated-2a.cc: New test.
+
2020-01-09 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93205
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index f983743..875a5e7 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -78,6 +78,7 @@
// _GLIBCXX_USE_DEPRECATED
// _GLIBCXX_DEPRECATED
// _GLIBCXX17_DEPRECATED
+// _GLIBCXX20_DEPRECATED( string-literal )
#ifndef _GLIBCXX_USE_DEPRECATED
# define _GLIBCXX_USE_DEPRECATED 1
#endif
@@ -94,6 +95,12 @@
# define _GLIBCXX17_DEPRECATED
#endif
+#if defined(__DEPRECATED) && (__cplusplus > 201703L)
+# define _GLIBCXX20_DEPRECATED(MSG) [[deprecated(MSG)]]
+#else
+# define _GLIBCXX20_DEPRECATED(MSG)
+#endif
+
// Macros for ABI tag attributes.
#ifndef _GLIBCXX_ABI_TAG_CXX11
# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 061835b..c69867c 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -685,10 +685,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
"template argument must be a complete class or an unbounded array");
};
- /// is_pod
+ /// is_pod (deprecated in C++20)
// Could use is_standard_layout && is_trivial instead of the builtin.
template<typename _Tp>
- struct is_pod
+ struct
+ _GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead")
+ is_pod
: public integral_constant<bool, __is_pod(_Tp)>
{
static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
@@ -3078,6 +3080,7 @@ template <typename _Tp>
template <typename _Tp>
inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
template <typename _Tp>
+ _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead")
inline constexpr bool is_pod_v = is_pod<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
diff --git a/libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc b/libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc
new file mode 100644
index 0000000..848baf7
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2020 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/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <type_traits>
+
+static_assert(std::is_pod<int>::value); // { dg-warning "is deprecated" }
+static_assert(std::is_pod_v<int>); // { dg-warning "is deprecated" }
+
+// { dg-prune-output "declared here" }
More information about the Libstdc++-cvs
mailing list