[ PATCH ] [ C++ ] Implementing P0767 - deprecate POD

Jonathan Wakely jwakely@redhat.com
Wed Dec 4 21:47:00 GMT 2019


On 03/12/19 20:30 -0500, JeanHeyd Meneide wrote:
>This patch implements deprecate POD for the C++ Standard Library,

Thanks.

>bringing libstdc++ that much closer to 2020 conformance 🎉!

N.B. adding the attribute is not required for conformance.

>+#if defined(__DEPRECATED) && (__cplusplus > 201703L)
>+# define _GLIBCXX20_DEPRECATED(...) [[deprecated(__VA_ARGS__)]]

Does this need to us __VA_ARGS__? Won't it always be a single
preprocessor token, specifically, a string literal?

>+#else
>+# define _GLIBCXX20_DEPRECATED(...)
>+#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 8e787a994c3..91269d1bd02 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 C++2a)
>   // Could use is_standard_layout && is_trivial instead of the builtin.
>   template<typename _Tp>
>-    struct is_pod
>+    struct
>+    _GLIBCXX20_DEPRECATED("is_pod<Type> is deprecated in C++20: use is_standard_layout<Type> && is_trivial<Type> instead")

That isn't a valid expression, it should probably say:

"use is_standard_layout_v<Type> && is_trivial_v<Type> instead"

i.e. recommend the variable templates.

I think I'd prefer "T" rather than "Type".

>+// Copyright (C) 2010-2019 Free Software Foundation, Inc.

Just 2019 for the date. It's a new file.



More information about the Libstdc++ mailing list