-
Couldn't load subscription status.
- Fork 15k
[libc++] Remove the packaged_task::result_type extension
#147671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc++] Remove the packaged_task::result_type extension
#147671
Conversation
No escape hatch added, as there doesn't seem anyone critically relying on this.
|
@llvm/pr-subscribers-libcxx Author: A. Jiang (frederick-vs-ja) ChangesNo escape hatch added, as there doesn't seem anyone critically relying on this. Closes #112856. Full diff: https://github.com/llvm/llvm-project/pull/147671.diff 4 Files Affected:
diff --git a/libcxx/docs/ReleaseNotes/21.rst b/libcxx/docs/ReleaseNotes/21.rst
index 2cb560b3852f3..30c2159304b03 100644
--- a/libcxx/docs/ReleaseNotes/21.rst
+++ b/libcxx/docs/ReleaseNotes/21.rst
@@ -98,7 +98,7 @@ Deprecations and Removals
- libc++ no longer adds ``constexpr`` to ``std::hash<std::vector<bool, A>>::operator()``, as the ``constexpr`` addition
since C++20 was an unintended extension.
-- TODO: The non-conforming extension ``packaged_task::result_type`` has been removed in LLVM 21.
+- The non-conforming extension ``packaged_task::result_type`` has been removed in LLVM 21.
Potentially breaking changes
----------------------------
diff --git a/libcxx/include/future b/libcxx/include/future
index 31932aeeb6b82..abdd82dc95dd7 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -322,8 +322,6 @@ template <class R, class... ArgTypes>
class packaged_task<R(ArgTypes...)>
{
public:
- typedef R result_type; // extension
-
// construction and destruction
packaged_task() noexcept;
template <class F>
@@ -1605,9 +1603,6 @@ inline _Rp __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes...
template <class _Rp, class... _ArgTypes>
class packaged_task<_Rp(_ArgTypes...)> {
-public:
- using result_type _LIBCPP_DEPRECATED = _Rp; // extension
-
private:
__packaged_task_function<_Rp(_ArgTypes...)> __f_;
promise<_Rp> __p_;
@@ -1699,9 +1694,6 @@ void packaged_task<_Rp(_ArgTypes...)>::reset() {
template <class... _ArgTypes>
class packaged_task<void(_ArgTypes...)> {
-public:
- using result_type _LIBCPP_DEPRECATED = void; // extension
-
private:
__packaged_task_function<void(_ArgTypes...)> __f_;
promise<void> __p_;
diff --git a/libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp
deleted file mode 100644
index 659232caa46ec..0000000000000
--- a/libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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: no-threads
-// UNSUPPORTED: c++03
-
-// <future>
-
-// template<class R, class... ArgTypes>
-// class packaged_task<R(ArgTypes...)>
-// {
-// public:
-// typedef R result_type; // extension
-
-// This is a libc++ extension.
-
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
-
-#include <future>
-#include <type_traits>
-
-struct A {};
-
-int main(int, char**) {
- static_assert((std::is_same<std::packaged_task<A(int, char)>::result_type, A>::value), "");
- static_assert((std::is_same<std::packaged_task<void(int, char)>::result_type, void>::value), "");
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/thread/futures/futures.task/type.depr.verify.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp
similarity index 62%
rename from libcxx/test/libcxx/thread/futures/futures.task/type.depr.verify.cpp
rename to libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp
index 4065637e9eb2a..72171c99a6122 100644
--- a/libcxx/test/libcxx/thread/futures/futures.task/type.depr.verify.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp
@@ -11,18 +11,12 @@
// <future>
-// template<class R, class... ArgTypes>
-// class packaged_task<R(ArgTypes...)>
-// {
-// public:
-// typedef R result_type; // extension
-
-// This libc++ extension is deprecated. See https://github.com/llvm/llvm-project/issues/112856.
+// Verify that the non-conforming extension packaged_task::result_type is removed.
+// See https://github.com/llvm/llvm-project/issues/112856.
#include <future>
-#include <type_traits>
struct A {};
-using RA = std::packaged_task<A(int, char)>::result_type; // expected-warning {{'result_type' is deprecated}}
-using RV = std::packaged_task<void(int, char)>::result_type; // expected-warning {{'result_type' is deprecated}}
+using RA = std::packaged_task<A(int, char)>::result_type; // expected-error {{no type named 'result_type'}}
+using RV = std::packaged_task<void(int, char)>::result_type; // expected-error {{no type named 'result_type'}}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup!
No escape hatch added, as there doesn't seem anyone critically relying on this.
Closes #112856.