[libcxx-commits] [libcxx] 8b171a0 - [libc++] Remove the `packaged_task::result_type` extension (#147671)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 10 00:04:52 PDT 2025
Author: A. Jiang
Date: 2025-07-10T15:04:49+08:00
New Revision: 8b171a08db946ad382a3726d9deb9420d43a59ee
URL: https://github.com/llvm/llvm-project/commit/8b171a08db946ad382a3726d9deb9420d43a59ee
DIFF: https://github.com/llvm/llvm-project/commit/8b171a08db946ad382a3726d9deb9420d43a59ee.diff
LOG: [libc++] Remove the `packaged_task::result_type` extension (#147671)
No escape hatch added, as there doesn't seem anyone critically relying
on this.
Added:
libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp
Modified:
libcxx/docs/ReleaseNotes/21.rst
libcxx/include/future
Removed:
libcxx/test/libcxx/thread/futures/futures.task/type.depr.verify.cpp
libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp
################################################################################
diff --git a/libcxx/docs/ReleaseNotes/21.rst b/libcxx/docs/ReleaseNotes/21.rst
index e084ad9ba53d5..3d70fa38d971e 100644
--- a/libcxx/docs/ReleaseNotes/21.rst
+++ b/libcxx/docs/ReleaseNotes/21.rst
@@ -100,7 +100,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'}}
More information about the libcxx-commits
mailing list