From 3561b138f60b00f47a87cda799d3129b11d3a888 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 9 Jul 2025 15:39:31 +0800 Subject: [PATCH] [libc++] Remove the `packaged_task::result_type` extension No escape hatch added, as there doesn't seem anyone critically relying on this. --- libcxx/docs/ReleaseNotes/21.rst | 2 +- libcxx/include/future | 8 ----- .../futures/futures.task/types.pass.cpp | 34 ------------------- .../futures.task.members/type.verify.cpp} | 14 +++----- 4 files changed, 5 insertions(+), 53 deletions(-) delete mode 100644 libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp rename libcxx/test/{libcxx/thread/futures/futures.task/type.depr.verify.cpp => std/thread/futures/futures.task/futures.task.members/type.verify.cpp} (62%) 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>::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 packaged_task { public: - typedef R result_type; // extension - // construction and destruction packaged_task() noexcept; template @@ -1605,9 +1603,6 @@ inline _Rp __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... template 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 packaged_task { -public: - using result_type _LIBCPP_DEPRECATED = void; // extension - private: __packaged_task_function __f_; promise __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 - -// - -// template -// class packaged_task -// { -// public: -// typedef R result_type; // extension - -// This is a libc++ extension. - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - -#include -#include - -struct A {}; - -int main(int, char**) { - static_assert((std::is_same::result_type, A>::value), ""); - static_assert((std::is_same::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 @@ // -// template -// class packaged_task -// { -// 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 -#include struct A {}; -using RA = std::packaged_task::result_type; // expected-warning {{'result_type' is deprecated}} -using RV = std::packaged_task::result_type; // expected-warning {{'result_type' is deprecated}} +using RA = std::packaged_task::result_type; // expected-error {{no type named 'result_type'}} +using RV = std::packaged_task::result_type; // expected-error {{no type named 'result_type'}}