[libcxx] deprecates/removes `std::raw_storage_iterator`
authorChristopher Di Bella <cjdb@google.com>
Sun, 2 May 2021 20:39:35 +0000 (20:39 +0000)
committerChristopher Di Bella <cjdb@google.com>
Tue, 11 May 2021 06:43:29 +0000 (06:43 +0000)
C++17 deprecates `std::raw_storage_iterator` and C++20 removes it.

Implements part of:
  * P0174R2 'Deprecating Vestigial Library Parts in C++17'
  * P0619R4 'Reviewing Deprecated Facilities of C++17 for C++20'

Differential Revision: https://reviews.llvm.org/D101730

libcxx/include/__memory/raw_storage_iterator.h
libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp [new file with mode: 0644]
libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp

index e2ae313..529fcd5 100644 (file)
@@ -25,8 +25,10 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if _LIBCPP_STD_VER <= 17
+
 template <class _OutputIterator, class _Tp>
-class _LIBCPP_TEMPLATE_VIS raw_storage_iterator
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
     : public iterator<output_iterator_tag,
                       _Tp,                                         // purposefully not C++03
                       ptrdiff_t,                                   // purposefully not C++03
@@ -52,6 +54,8 @@ public:
 #endif
 };
 
+#endif // _LIBCPP_STD_VER <= 17
+
 _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
diff --git a/libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp b/libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
new file mode 100644 (file)
index 0000000..a39f3ba
--- /dev/null
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// 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: c++17
+
+// std::raw_storage_iterator
+
+#include <memory>
+
+std::raw_storage_iterator<int*, int> it(nullptr);
+// expected-warning@-1{{'raw_storage_iterator<int *, int>' is deprecated}}
index 5355d09..5670e5f 100644 (file)
@@ -6,8 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+
 // raw_storage_iterator
 
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <memory>
 #include <type_traits>
 #include <cassert>
index 2b9b33f..367482b 100644 (file)
@@ -6,8 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+
 // raw_storage_iterator
 
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <memory>
 #include <type_traits>
 #include <cassert>