[libcxx-commits] [libcxx] [libc++] Deprecate non-standard std::launch::any extension (PR #173397)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 23 09:23:20 PST 2025
https://github.com/sohail103 created https://github.com/llvm/llvm-project/pull/173397
std::launch::any was a draft C++11 feature that was removed before the final standard. It has remained in libc++ as an extension. This patch marks it as deprecated to warn users who might be relying on it unintentionally.
Updated the future header and added a verify test to check for the deprecation warning.
Fixes #173219
>From eedfcc61aeabf4ded455bfb48c35fd86024dcce5 Mon Sep 17 00:00:00 2001
From: sohail103 <sohailraj.satapathy at gmail.com>
Date: Tue, 23 Dec 2025 17:07:21 +0000
Subject: [PATCH] [libc++] Deprecate non-standard std::launch::any extension
std::launch::any was a draft C++11 feature that was removed before the final standard.
It has remained in libc++ as an extension. This patch marks it as deprecated to warn users
who might be relying on it unintentionally.
Updated the future header and added a verify test to check for the deprecation warning.
---
libcxx/include/future | 2 +-
.../futures/launch_any_deprecated.verify.cpp | 21 +++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 libcxx/test/libcxx/thread/futures/launch_any_deprecated.verify.cpp
diff --git a/libcxx/include/future b/libcxx/include/future
index c249bc5e7938f..999ddeec575ee 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -434,7 +434,7 @@ struct is_error_code_enum<future_errc::__lx> : public true_type {};
# endif
// enum class launch
-_LIBCPP_DECLARE_STRONG_ENUM(launch){async = 1, deferred = 2, any = async | deferred};
+_LIBCPP_DECLARE_STRONG_ENUM(launch){async = 1, deferred = 2, any _LIBCPP_DEPRECATED = async | deferred};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
# ifndef _LIBCPP_CXX03_LANG
diff --git a/libcxx/test/libcxx/thread/futures/launch_any_deprecated.verify.cpp b/libcxx/test/libcxx/thread/futures/launch_any_deprecated.verify.cpp
new file mode 100644
index 0000000000000..aa6ed5cccecb6
--- /dev/null
+++ b/libcxx/test/libcxx/thread/futures/launch_any_deprecated.verify.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <future>
+
+// enum class launch;
+
+// Verify that std::launch::any is deprecated.
+// It was a draft C++11 feature that was removed, but libc++ kept it as an extension.
+
+#include <future>
+
+void test() {
+ auto l = std::launch::any; // expected-warning {{'any' is deprecated}}
+ (void)l;
+}
More information about the libcxx-commits
mailing list