[libcxx-commits] [libcxx] 578d09c - [libcxx] deprecates/removes `std::raw_storage_iterator`

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 10 23:43:57 PDT 2021


Author: Christopher Di Bella
Date: 2021-05-11T06:43:29Z
New Revision: 578d09c1b195d859ca7e62840ff6bb83421a77b5

URL: https://github.com/llvm/llvm-project/commit/578d09c1b195d859ca7e62840ff6bb83421a77b5
DIFF: https://github.com/llvm/llvm-project/commit/578d09c1b195d859ca7e62840ff6bb83421a77b5.diff

LOG: [libcxx] deprecates/removes `std::raw_storage_iterator`

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

Added: 
    libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp

Modified: 
    libcxx/include/__memory/raw_storage_iterator.h
    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

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__memory/raw_storage_iterator.h b/libcxx/include/__memory/raw_storage_iterator.h
index e2ae31397a8a7..529fcd54adaeb 100644
--- a/libcxx/include/__memory/raw_storage_iterator.h
+++ b/libcxx/include/__memory/raw_storage_iterator.h
@@ -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
                       ptr
diff _t,                                   // purposefully not C++03
@@ -52,6 +54,8 @@ class _LIBCPP_TEMPLATE_VIS raw_storage_iterator
 #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
index 0000000000000..a39f3bae578cb
--- /dev/null
+++ b/libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
@@ -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 at -1{{'raw_storage_iterator<int *, int>' is deprecated}}

diff  --git a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
index 5355d09ac26be..5670e5f957287 100644
--- a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
+++ b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
@@ -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>

diff  --git a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
index 2b9b33fd9b998..367482bce5159 100644
--- a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
+++ b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
@@ -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>


        


More information about the libcxx-commits mailing list