[libcxx-commits] [PATCH] D101730: [libcxx] deprecates/removes `std::raw_storage_iterator`
Christopher Di Bella via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun May 2 13:45:42 PDT 2021
cjdb created this revision.
cjdb added reviewers: ldionne, EricWF, zoecarver, Quuxplusone, Mordante, curdeius.
cjdb requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
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'
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101730
Files:
libcxx/include/__memory/raw_storage_iterator.h
libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
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: libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
+++ libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
@@ -6,8 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++20, c++2b
+
// raw_storage_iterator
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
#include <memory>
#include <type_traits>
#include <cassert>
Index: libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
+++ libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++20, c++2b
+
// raw_storage_iterator
#include <memory>
@@ -14,6 +16,9 @@
#include "test_macros.h"
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
Index: libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
===================================================================
--- /dev/null
+++ libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++20, c++2b
+
+// std::raw_storage_iterator
+
+#include <memory>
+
+#include "test_macros.h"
+
+struct A {
+ explicit A(int i);
+ bool operator==(int i) const;
+ A* operator&() = delete;
+};
+
+void f() {
+ struct S {};
+ using Storage = std::aligned_storage<3 * sizeof(S), std::alignment_of<S>::value>::type;
+ Storage buffer;
+ std::raw_storage_iterator<S*, S> it((S*)&buffer); // expected-warning {{'raw_storage_iterator<S *, S>' is deprecated}}
+}
Index: libcxx/include/__memory/raw_storage_iterator.h
===================================================================
--- libcxx/include/__memory/raw_storage_iterator.h
+++ libcxx/include/__memory/raw_storage_iterator.h
@@ -25,8 +25,9 @@
_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 +53,8 @@
#endif
};
+#endif // _LIBCPP_STD_VER <= 17
+
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101730.342272.patch
Type: text/x-patch
Size: 3382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210502/daa32ca8/attachment.bin>
More information about the libcxx-commits
mailing list