diff --git a/libcxx/docs/ReleaseNotes/21.rst b/libcxx/docs/ReleaseNotes/21.rst index f45a448e52cc0..c45adbaec3953 100644 --- a/libcxx/docs/ReleaseNotes/21.rst +++ b/libcxx/docs/ReleaseNotes/21.rst @@ -39,6 +39,7 @@ Implemented Papers ------------------ - N4258: Cleaning-up noexcept in the Library (`Github `__) +- P0767R1: Deprecate POD (`Github `__) - P1361R2: Integration of chrono with text formatting (`Github `__) Improvements and New Features @@ -58,6 +59,8 @@ Improvements and New Features Deprecations and Removals ------------------------- +- ``std::is_pod`` and ``std::is_pod_v`` are deprecated in C++20 and later. + Upcoming Deprecations and Removals ---------------------------------- diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv index cb25006797055..4430b785334c1 100644 --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -13,7 +13,7 @@ "`P0616R0 `__","de-pessimize legacy algorithms with std::move","2017-11 (Albuquerque)","|Complete|","12","" "`P0653R2 `__","Utility to convert a pointer to a raw pointer","2017-11 (Albuquerque)","|Complete|","6","" "`P0718R2 `__","Atomic shared_ptr","2017-11 (Albuquerque)","","","" -"`P0767R1 `__","Deprecate POD","2017-11 (Albuquerque)","|Complete|","7","" +"`P0767R1 `__","Deprecate POD","2017-11 (Albuquerque)","|Complete|","21","It was previously erroneously marked as complete in LLVM 7." "`P0768R1 `__","Library Support for the Spaceship (Comparison) Operator","2017-11 (Albuquerque)","|Complete|","","" "`P0777R1 `__","Treating Unnecessary ``decay``\ ","2017-11 (Albuquerque)","|Complete|","7","" "","","","","","" diff --git a/libcxx/include/__type_traits/is_pod.h b/libcxx/include/__type_traits/is_pod.h index a57662400394a..b6aacf3b2b202 100644 --- a/libcxx/include/__type_traits/is_pod.h +++ b/libcxx/include/__type_traits/is_pod.h @@ -19,11 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_pod_v = __is_pod(_Tp); +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_pod_v = __is_pod(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index ffcddb0176615..772e4cb876469 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -95,8 +95,8 @@ namespace std template struct is_unbounded_array; // C++20 // Member introspection: - template struct is_pod; template struct is_trivial; + template struct is_pod; // Deprecated in C++20 template struct is_trivially_copyable; template struct is_standard_layout; template struct is_literal_type; // Deprecated in C++17; removed in C++20 @@ -303,7 +303,7 @@ namespace std template inline constexpr bool is_standard_layout_v = is_standard_layout::value; // C++17 template inline constexpr bool is_pod_v - = is_pod::value; // C++17 + = is_pod::value; // C++17; deprecated in C++20 template inline constexpr bool is_literal_type_v = is_literal_type::value; // C++17; deprecated in C++17; removed in C++20 template inline constexpr bool is_empty_v diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.deprecated.verify.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.deprecated.verify.cpp new file mode 100644 index 0000000000000..0f9b1856591d8 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.deprecated.verify.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// REQUIRES: std-at-least-c++20 + +// + +// is_pod and is_pod_v are deprecated in C++20 by P0767R1 + +#include + +static_assert(std::is_pod::value); // expected-warning {{'is_pod' is deprecated}} +static_assert(std::is_pod_v); // expected-warning {{'is_pod_v' is deprecated}} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp index 87fe6ebbee883..887033fc72d86 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp @@ -10,6 +10,8 @@ // is_pod +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS + #include #include "test_macros.h"