[clang] [Clang] No longer advertise support for coroutines on x86 windows. (PR #193456)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 22 03:17:49 PDT 2026
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/193456
There are a large number of long standing issues with coroutines on x86_32 windows as discussed here
https://github.com/llvm/llvm-project/issues/59382
- #59382
- #58556
- #58543
- #56989
- #193161
- #136481
As such this patches
- No longer defines `__cpp_impl_coroutine` on that platform
- Warn when using coroutines on that platform
The reason to not plainly error is that it would break too much valid valid code, ie there are people who probably use coroutines sucessfully.
And we also want to keep testing on that platform, up until the point we were to pull support completely.
Hopefully this is all temporary and someone will feel compelled to improve the situation enough that we can unceremoniously revert this patch.
>From 29b28c824753a661ba00e12469d77774211fd250 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Wed, 22 Apr 2026 11:59:22 +0200
Subject: [PATCH] [Clang] No longer advertise support for coroutines on x86
windows.
There are a large number of long standing issues with coroutines
on x86_32 windows as discussed here
https://github.com/llvm/llvm-project/issues/59382
- #59382
- #58556
- #58543
- #56989
- #193161
- #136481
As such this patches
- No longer defines `__cpp_impl_coroutine` on that platform
- Warn when using coroutines on that platform
The reason to not plainly error is that it would break too much valid
valid code, ie there are people who probably use coroutines sucessfully.
And we also want to keep testing on that platform, up until the point we
were to pull support completely.
Hopefully this is all temporary and someone will feel compelled to
improve the situation enough that we can unceremoniously revert this
patch.
---
clang/docs/ReleaseNotes.rst | 5 ++-
.../clang/Basic/DiagnosticSemaKinds.td | 4 +++
clang/lib/Frontend/InitPreprocessor.cpp | 12 +++++--
clang/lib/Sema/SemaCoroutine.cpp | 8 +++++
...da-captures-co_await-assertion-failure.cpp | 2 +-
clang/test/Analysis/more-dtors-cfg-output.cpp | 4 +--
clang/test/CodeGenCXX/ubsan-coroutines.cpp | 2 +-
clang/test/CodeGenCoroutines/coro-params.cpp | 2 +-
.../CodeGenCoroutines/coro-promise-dtor.cpp | 2 +-
clang/test/Lexer/cxx-features.cpp | 14 ++++++--
clang/test/Modules/coro-await-elidable.cppm | 4 +--
clang/test/PCH/coroutines.cpp | 6 ++--
clang/test/Parser/cxx20-coroutines.cpp | 2 +-
.../test/SemaCXX/addr-label-in-coroutines.cpp | 2 +-
clang/test/SemaCXX/co_await-ast.cpp | 4 +--
clang/test/SemaCXX/coroutine-alloc-2.cpp | 2 +-
clang/test/SemaCXX/coroutine-alloc-3.cpp | 2 +-
clang/test/SemaCXX/coroutine-alloc-4.cpp | 4 +--
clang/test/SemaCXX/coroutine-allocs.cpp | 2 +-
clang/test/SemaCXX/coroutine-builtins.cpp | 4 +--
clang/test/SemaCXX/coroutine-dealloc.cpp | 2 +-
.../coroutine-final-suspend-noexcept.cpp | 2 +-
.../SemaCXX/coroutine-no-valid-dealloc.cpp | 2 +-
clang/test/SemaCXX/coroutine-noreturn.cpp | 2 +-
clang/test/SemaCXX/coroutine-promise-ctor.cpp | 2 +-
clang/test/SemaCXX/coroutine-rvo.cpp | 2 +-
.../coroutine-traits-undefined-template.cpp | 2 +-
clang/test/SemaCXX/coroutine-unevaluate.cpp | 2 +-
clang/test/SemaCXX/coroutine-vla.cpp | 2 +-
clang/test/SemaCXX/coroutine-win32x86.cpp | 35 +++++++++++++++++++
.../coroutine_handle-address-return-type.cpp | 2 +-
clang/test/SemaCXX/coroutines.cpp | 4 +--
.../cxx20-delayed-typo-correction-crashes.cpp | 2 +-
.../test/SemaCXX/cxx2b-deducing-this-coro.cpp | 2 +-
clang/test/SemaCXX/thread-safety-coro.cpp | 2 +-
.../SemaCXX/warn-throw-out-noexcept-coro.cpp | 2 +-
clang/test/SemaCXX/warn-unsequenced-coro.cpp | 2 +-
.../warn-unused-parameters-coroutine.cpp | 2 +-
clang/www/cxx_status.html | 5 +--
39 files changed, 115 insertions(+), 48 deletions(-)
create mode 100644 clang/test/SemaCXX/coroutine-win32x86.cpp
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b25bc08b033d2..2209299cef6b3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -86,7 +86,10 @@ Clang Frontend Potentially Breaking Changes
libraries will need to be recompiled, or used with
(`--no-offload-new-driver`). This option will be removed in the next release.
-
+- Clang no longer defines the ``__cpp_impl_coroutine`` feature test macro under the 32 bits x86 Microsoft ABI,
+ as support for coroutines on this target is incomplete.
+ When using coroutines on this target a warning is emmitted to indicate the lack of full support.
+ That warning can be disabled with ``-Wno-coroutines-unsupported-target``.
Clang Python Bindings Potentially Breaking Changes
--------------------------------------------------
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 3ab8dd412a7ad..f8dfdb2d76aaa 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -12881,6 +12881,10 @@ def note_redefinition_include_same_file : Note<
}
let CategoryName = "Coroutines Issue" in {
+def warn_coroutines_x86_windows : Warning<
+ "coroutines support when targeting the 32 bits x86 Microsoft ABI"
+ " is experimental and incomplete">,
+ InGroup<DiagGroup<"coroutines-unsupported-target">>;
def err_return_in_coroutine : Error<
"return statement not allowed in coroutine; did you mean 'co_return'?">;
def note_declared_coroutine_here : Note<
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 1ccd74314f373..1c3fa27f765ef 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -621,7 +621,8 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
/// Initialize the predefined C++ language feature test macros defined in
/// ISO/IEC JTC1/SC22/WG21 (C++) SD-6: "SG10 Feature Test Recommendations".
static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
- MacroBuilder &Builder) {
+ MacroBuilder &Builder,
+ const TargetInfo &TI) {
// C++98 features.
if (LangOpts.RTTI)
Builder.defineMacro("__cpp_rtti", "199711L");
@@ -714,7 +715,12 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_consteval", "202211L");
Builder.defineMacro("__cpp_constexpr_dynamic_alloc", "201907L");
Builder.defineMacro("__cpp_constinit", "201907L");
- Builder.defineMacro("__cpp_impl_coroutine", "201902L");
+
+ // Support for coroutines on 32 bits x86 Microsoft platforms is
+ // incomplete, do not advertise it.
+ if (!(TI.getCXXABI().isMicrosoft() && TI.getTriple().isX86_32()))
+ Builder.defineMacro("__cpp_impl_coroutine", "201902L");
+
Builder.defineMacro("__cpp_designated_initializers", "201707L");
Builder.defineMacro("__cpp_impl_three_way_comparison", "201907L");
// Intentionally to set __cpp_modules to 1.
@@ -980,7 +986,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
Twine(TI.useSignedCharForObjCBool() ? "0" : "1"));
if (LangOpts.CPlusPlus)
- InitializeCPlusPlusFeatureTestMacros(LangOpts, Builder);
+ InitializeCPlusPlusFeatureTestMacros(LangOpts, Builder, TI);
// darwin_constant_cfstrings controls this. This is also dependent
// on other things like the runtime I believe. This is set even for C code.
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 07bb6e2161cc7..7f9b1d642cf9d 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -21,6 +21,7 @@
#include "clang/AST/IgnoreExpr.h"
#include "clang/AST/StmtCXX.h"
#include "clang/Basic/Builtins.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
@@ -693,6 +694,13 @@ bool Sema::ActOnCoroutineBodyStart(Scope *SC, SourceLocation KWLoc,
if (!checkCoroutineContext(*this, KWLoc, Keyword))
return false;
+
+ // Support for coroutines is not stable on 32 bits windows
+ // Warn about it.
+ if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+ Context.getTargetInfo().getTriple().isX86_32())
+ Diag(KWLoc, diag::warn_coroutines_x86_windows);
+
auto *ScopeInfo = getCurFunction();
assert(ScopeInfo->CoroutinePromise);
diff --git a/clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-co_await-assertion-failure.cpp b/clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-co_await-assertion-failure.cpp
index a67f45700cd10..0fd9759e925e6 100644
--- a/clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-co_await-assertion-failure.cpp
+++ b/clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-co_await-assertion-failure.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.UncountedLambdaCapturesChecker -std=c++20 -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.UncountedLambdaCapturesChecker -std=c++20 -verify %s -Wno-coroutines-unsupported-target
// expected-no-diagnostics
template<typename Arg>
diff --git a/clang/test/Analysis/more-dtors-cfg-output.cpp b/clang/test/Analysis/more-dtors-cfg-output.cpp
index 044e0b7d6dcfd..1759e9d598d94 100644
--- a/clang/test/Analysis/more-dtors-cfg-output.cpp
+++ b/clang/test/Analysis/more-dtors-cfg-output.cpp
@@ -1,6 +1,6 @@
// RUN: rm -f %t.14 %t.2a
-// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -std=c++14 -DCXX2A=0 -fblocks -Wall -Wno-unused -Werror %s > %t.14 2>&1
-// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -std=c++2a -DCXX2A=1 -fblocks -Wall -Wno-unused -Werror %s > %t.2a 2>&1
+// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -std=c++14 -DCXX2A=0 -fblocks -Wall -Wno-unused -Werror -Wno-coroutines-unsupported-target %s > %t.14 2>&1
+// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -std=c++2a -DCXX2A=1 -fblocks -Wall -Wno-unused -Werror -Wno-coroutines-unsupported-target %s > %t.2a 2>&1
// RUN: FileCheck --input-file=%t.14 -check-prefixes=CHECK,CXX14 -implicit-check-not=destructor %s
// RUN: FileCheck --input-file=%t.2a -check-prefixes=CHECK,CXX2A -implicit-check-not=destructor %s
diff --git a/clang/test/CodeGenCXX/ubsan-coroutines.cpp b/clang/test/CodeGenCXX/ubsan-coroutines.cpp
index 60c89a47f9046..85fc6ceb523d3 100644
--- a/clang/test/CodeGenCXX/ubsan-coroutines.cpp
+++ b/clang/test/CodeGenCXX/ubsan-coroutines.cpp
@@ -1,6 +1,6 @@
// This test merely verifies that emitting the object file does not cause a
// crash when the LLVM coroutines passes are run.
-// RUN: %clang_cc1 -emit-obj -std=c++2a -fsanitize=null %s -o %t.o
+// RUN: %clang_cc1 -emit-obj -std=c++2a -fsanitize=null -Wno-coroutines-unsupported-target %s -o %t.o
// UNSUPPORTED: target={{.*}}-zos{{.*}}
namespace std {
diff --git a/clang/test/CodeGenCoroutines/coro-params.cpp b/clang/test/CodeGenCoroutines/coro-params.cpp
index 79e77a21017fa..173f63fb394e5 100644
--- a/clang/test/CodeGenCoroutines/coro-params.cpp
+++ b/clang/test/CodeGenCoroutines/coro-params.cpp
@@ -3,7 +3,7 @@
// Vefifies that parameter copies are used in the body of the coroutine
// Verifies that parameter copies are used to construct the promise type, if that type has a matching constructor
// RUN: %clang_cc1 -std=c++20 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s -disable-llvm-passes -fexceptions | FileCheck %s
-// RUN: %clang_cc1 -std=c++20 -triple=x86_64-pc-win32 -emit-llvm -o - %s -disable-llvm-passes -fexceptions | FileCheck %s --check-prefix=MSABI
+// RUN: %clang_cc1 -std=c++20 -triple=x86_64-pc-win32 -emit-llvm -o - %s -disable-llvm-passes -fexceptions -Wno-coroutines-unsupported-target | FileCheck %s --check-prefix=MSABI
namespace std {
template <typename... T> struct coroutine_traits;
diff --git a/clang/test/CodeGenCoroutines/coro-promise-dtor.cpp b/clang/test/CodeGenCoroutines/coro-promise-dtor.cpp
index afaaf876a8103..902ed7d315edf 100644
--- a/clang/test/CodeGenCoroutines/coro-promise-dtor.cpp
+++ b/clang/test/CodeGenCoroutines/coro-promise-dtor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++20 -triple=x86_64-pc-windows-msvc18.0.0 -emit-llvm -o - %s -fexceptions -fcxx-exceptions -disable-llvm-passes | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 -triple=x86_64-pc-windows-msvc18.0.0 -emit-llvm -o - %s -fexceptions -fcxx-exceptions -disable-llvm-passes -Wno-coroutines-unsupported-target | FileCheck %s
// -triple=x86_64-unknown-linux-gnu
#include "Inputs/coroutine.h"
diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp
index 8eb9ea032879c..171ef99cee5b7 100644
--- a/clang/test/Lexer/cxx-features.cpp
+++ b/clang/test/Lexer/cxx-features.cpp
@@ -6,6 +6,11 @@
// RUN: %clang_cc1 -std=c++23 -fcxx-exceptions -verify %s
// RUN: %clang_cc1 -std=c++2c -fcxx-exceptions -verify %s
+// RUN: %clang_cc1 -std=c++20 -fcxx-exceptions -verify -triple i686-unknown-windows-msvc -DX86_MSVC_TARGET %s
+// RUN: %clang_cc1 -std=c++23 -fcxx-exceptions -verify -triple i686-unknown-windows-msvc -DX86_MSVC_TARGET %s
+// RUN: %clang_cc1 -std=c++2c -fcxx-exceptions -verify -triple i686-unknown-windows-msvc -DX86_MSVC_TARGET %s
+
+
//
// RUN: %clang_cc1 -std=c++17 -fcxx-exceptions -DCONCEPTS_TS=1 -verify %s
// RUN: %clang_cc1 -std=c++14 -fno-rtti -fno-threadsafe-statics -verify %s -DNO_EXCEPTIONS -DNO_RTTI -DNO_THREADSAFE_STATICS
@@ -142,8 +147,13 @@
#error "wrong value for __cpp_impl_three_way_comparison"
#endif
-#if check(impl_coroutine, 0, 0, 0, 0, 201902L, 201902L, 201902L)
-#error "wrong value for __cpp_impl_coroutine"
+
+#if X86_MSVC_TARGET
+# if check(impl_coroutine, 0, 0, 0, 0, 0, 0, 0)
+# error "wrong value for __cpp_impl_coroutine"
+# endif
+#elif !(__i386__ && _WIN32) && check(impl_coroutine, 0, 0, 0, 0, 201902, 201902, 201902)
+# error "wrong value for __cpp_impl_coroutine" __cpp_impl_coroutine
#endif
// init_captures checked below
diff --git a/clang/test/Modules/coro-await-elidable.cppm b/clang/test/Modules/coro-await-elidable.cppm
index 2d635c6efa88b..e7bb97afb71d3 100644
--- a/clang/test/Modules/coro-await-elidable.cppm
+++ b/clang/test/Modules/coro-await-elidable.cppm
@@ -1,8 +1,8 @@
// RUN: rm -rf %t
// RUN: split-file %s %t
-// RUN: %clang_cc1 -std=c++20 %t/task.cppm -I%t -emit-reduced-module-interface -o %t/task.pcm
-// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/user.cpp -verify -fsyntax-only
+// RUN: %clang_cc1 -std=c++20 %t/task.cppm -I%t -emit-reduced-module-interface -o %t/task.pcm -Wno-coroutines-unsupported-target
+// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/user.cpp -verify -fsyntax-only -Wno-coroutines-unsupported-target
//--- coroutine.h
diff --git a/clang/test/PCH/coroutines.cpp b/clang/test/PCH/coroutines.cpp
index 55c098bc27a70..5bf77f6c83dd9 100644
--- a/clang/test/PCH/coroutines.cpp
+++ b/clang/test/PCH/coroutines.cpp
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: %clang_cc1 -include %s -verify -std=c++20 %s
+// RUN: %clang_cc1 -include %s -verify -std=c++20 %s -Wno-coroutines-unsupported-target
// Test with pch.
-// RUN: %clang_cc1 -std=c++20 -emit-pch -o %t %s
-// RUN: %clang_cc1 -include-pch %t -verify -std=c++20 %s
+// RUN: %clang_cc1 -std=c++20 -emit-pch -o %t %s -Wno-coroutines-unsupported-target
+// RUN: %clang_cc1 -include-pch %t -verify -std=c++20 %s -Wno-coroutines-unsupported-target
#ifndef HEADER
#define HEADER
diff --git a/clang/test/Parser/cxx20-coroutines.cpp b/clang/test/Parser/cxx20-coroutines.cpp
index 7207fb98587ab..6e774a5712874 100644
--- a/clang/test/Parser/cxx20-coroutines.cpp
+++ b/clang/test/Parser/cxx20-coroutines.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++20 %s -verify
+// RUN: %clang_cc1 -std=c++20 %s -verify -Wno-coroutines-unsupported-target
template<typename T, typename U>
U f(T t) {
diff --git a/clang/test/SemaCXX/addr-label-in-coroutines.cpp b/clang/test/SemaCXX/addr-label-in-coroutines.cpp
index 65d78636e5cdd..82ca2afc473f5 100644
--- a/clang/test/SemaCXX/addr-label-in-coroutines.cpp
+++ b/clang/test/SemaCXX/addr-label-in-coroutines.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify -Wno-coroutines-unsupported-target %s
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/SemaCXX/co_await-ast.cpp b/clang/test/SemaCXX/co_await-ast.cpp
index 5be2004eb1072..90683cd08d482 100644
--- a/clang/test/SemaCXX/co_await-ast.cpp
+++ b/clang/test/SemaCXX/co_await-ast.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=foo %s | FileCheck %s --strict-whitespace
-// RUN: %clang_cc1 -std=c++20 -triple i386-windows-pc -ast-dump -ast-dump-filter=foo %s | FileCheck %s --strict-whitespace
+// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=foo %s -Wno-coroutines-unsupported-target | FileCheck %s --strict-whitespace
+// RUN: %clang_cc1 -std=c++20 -triple i386-windows-pc -ast-dump -ast-dump-filter=foo %s -Wno-coroutines-unsupported-target | FileCheck %s --strict-whitespace
namespace std {
template <typename, typename...> struct coroutine_traits;
diff --git a/clang/test/SemaCXX/coroutine-alloc-2.cpp b/clang/test/SemaCXX/coroutine-alloc-2.cpp
index bcebadc0a1f53..28b8723a4765e 100644
--- a/clang/test/SemaCXX/coroutine-alloc-2.cpp
+++ b/clang/test/SemaCXX/coroutine-alloc-2.cpp
@@ -1,5 +1,5 @@
// Tests that we wouldn't generate an allocation call in promise_type with (std::size_t, std::nothrow_t) in case we find promsie_type::get_return_object_on_allocation_failure;
-// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=c++20 -Wno-coroutines-unsupported-target %s -fsyntax-only -verify
namespace std {
template <typename... T>
diff --git a/clang/test/SemaCXX/coroutine-alloc-3.cpp b/clang/test/SemaCXX/coroutine-alloc-3.cpp
index 629ac88a3df8e..644548e2fe89f 100644
--- a/clang/test/SemaCXX/coroutine-alloc-3.cpp
+++ b/clang/test/SemaCXX/coroutine-alloc-3.cpp
@@ -1,5 +1,5 @@
// Tests that we'll emit the proper diagnostic message if we failed to find `::operator new(size_t, nothrow_t)`.
-// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=c++20 -Wno-coroutines-unsupported-target %s -fsyntax-only -verify
namespace std {
template <typename... T>
diff --git a/clang/test/SemaCXX/coroutine-alloc-4.cpp b/clang/test/SemaCXX/coroutine-alloc-4.cpp
index 262c163fb1789..8cc555431c569 100644
--- a/clang/test/SemaCXX/coroutine-alloc-4.cpp
+++ b/clang/test/SemaCXX/coroutine-alloc-4.cpp
@@ -1,5 +1,5 @@
// Tests that we'll find aligned allocation function properly.
-// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify -fcoro-aligned-allocation
+// RUN: %clang_cc1 %s -std=c++20 %s -Wno-coroutines-unsupported-target -fsyntax-only -verify -fcoro-aligned-allocation
#include "Inputs/std-coroutine.h"
@@ -109,7 +109,7 @@ task6 f5() { // expected-error 1+{{unable to find '::operator new(size_t, align_
co_return 43;
}
-void *operator new(std::size_t, std::align_val_t, std::nothrow_t) noexcept;
+void *operator new(std::size_t, std::align_val_t, std::nothrow_t) noexcept;
task6 f6() {
co_return 43;
diff --git a/clang/test/SemaCXX/coroutine-allocs.cpp b/clang/test/SemaCXX/coroutine-allocs.cpp
index e6b086bd1c720..703c422f985a8 100644
--- a/clang/test/SemaCXX/coroutine-allocs.cpp
+++ b/clang/test/SemaCXX/coroutine-allocs.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=c++20 -Wno-coroutines-unsupported-target -fsyntax-only -verify
#include "Inputs/std-coroutine.h"
namespace std {
diff --git a/clang/test/SemaCXX/coroutine-builtins.cpp b/clang/test/SemaCXX/coroutine-builtins.cpp
index f2d0eda37d707..9c31024f33c40 100644
--- a/clang/test/SemaCXX/coroutine-builtins.cpp
+++ b/clang/test/SemaCXX/coroutine-builtins.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
-// RUN: %clang_cc1 -fsyntax-only -verify -DERRORS %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-coroutines-unsupported-target -std=c++20 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-coroutines-unsupported-target -DERRORS %s
// Check that we don't crash when using __builtin_coro_* without the fcoroutine-ts or -std=c++20 option
diff --git a/clang/test/SemaCXX/coroutine-dealloc.cpp b/clang/test/SemaCXX/coroutine-dealloc.cpp
index 762a14465b297..7f8f57d9cd37b 100644
--- a/clang/test/SemaCXX/coroutine-dealloc.cpp
+++ b/clang/test/SemaCXX/coroutine-dealloc.cpp
@@ -1,5 +1,5 @@
// Tests that the behavior will be good if there are multiple operator delete in the promise_type.
-// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=c++20 -Wno-coroutines-unsupported-target %s -fsyntax-only -verify
// expected-no-diagnostics
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/SemaCXX/coroutine-final-suspend-noexcept.cpp b/clang/test/SemaCXX/coroutine-final-suspend-noexcept.cpp
index 35c00b84ea398..7ec46b3715c09 100644
--- a/clang/test/SemaCXX/coroutine-final-suspend-noexcept.cpp
+++ b/clang/test/SemaCXX/coroutine-final-suspend-noexcept.cpp
@@ -1,7 +1,7 @@
// This file contains references to sections of the Coroutines TS, which can be
// found at http://wg21.link/coroutines.
-// RUN: %clang_cc1 -std=c++20 -verify %s -fcxx-exceptions -fexceptions -Wunused-result
+// RUN: %clang_cc1 -std=c++20 -verify %s -fcxx-exceptions -fexceptions -Wunused-result -Wno-coroutines-unsupported-target
namespace std {
diff --git a/clang/test/SemaCXX/coroutine-no-valid-dealloc.cpp b/clang/test/SemaCXX/coroutine-no-valid-dealloc.cpp
index a5727d6f003bf..548c3b49e21d2 100644
--- a/clang/test/SemaCXX/coroutine-no-valid-dealloc.cpp
+++ b/clang/test/SemaCXX/coroutine-no-valid-dealloc.cpp
@@ -1,6 +1,6 @@
// Test that if the compiler will emit error message if the promise_type contain
// operator delete but none of them are available. This is required by the standard.
-// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify -Wno-coroutines-unsupported-target
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/SemaCXX/coroutine-noreturn.cpp b/clang/test/SemaCXX/coroutine-noreturn.cpp
index 4516b4e720ec0..f89ce12966991 100644
--- a/clang/test/SemaCXX/coroutine-noreturn.cpp
+++ b/clang/test/SemaCXX/coroutine-noreturn.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -Winvalid-noreturn -verify
+// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -Winvalid-noreturn -verify -Wno-coroutines-unsupported-target
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/SemaCXX/coroutine-promise-ctor.cpp b/clang/test/SemaCXX/coroutine-promise-ctor.cpp
index 7a06299712cb7..da4ba8675697d 100644
--- a/clang/test/SemaCXX/coroutine-promise-ctor.cpp
+++ b/clang/test/SemaCXX/coroutine-promise-ctor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++20 -ast-dump %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 -Wno-coroutines-unsupported-target -ast-dump %s | FileCheck %s
#include "Inputs/std-coroutine.h"
// Github issue: https://github.com/llvm/llvm-project/issues/78290
diff --git a/clang/test/SemaCXX/coroutine-rvo.cpp b/clang/test/SemaCXX/coroutine-rvo.cpp
index 6bf1dee67557c..bdbb407c6efed 100644
--- a/clang/test/SemaCXX/coroutine-rvo.cpp
+++ b/clang/test/SemaCXX/coroutine-rvo.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s
+// RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only -Wno-coroutines-unsupported-target %s
namespace std {
template <class Promise = void> struct coroutine_handle {
diff --git a/clang/test/SemaCXX/coroutine-traits-undefined-template.cpp b/clang/test/SemaCXX/coroutine-traits-undefined-template.cpp
index e7de0c80d7343..c07dd6628f25b 100644
--- a/clang/test/SemaCXX/coroutine-traits-undefined-template.cpp
+++ b/clang/test/SemaCXX/coroutine-traits-undefined-template.cpp
@@ -1,7 +1,7 @@
// This file contains references to sections of the Coroutines TS, which can be
// found at http://wg21.link/coroutines.
-// RUN: %clang_cc1 -std=c++20 -verify %s -fcxx-exceptions -fexceptions -Wunused-result
+// RUN: %clang_cc1 -std=c++20 -verify %s -fcxx-exceptions -fexceptions -Wunused-result -Wno-coroutines-unsupported-target
namespace std {
diff --git a/clang/test/SemaCXX/coroutine-unevaluate.cpp b/clang/test/SemaCXX/coroutine-unevaluate.cpp
index 164caed2836a1..52d705be594c8 100644
--- a/clang/test/SemaCXX/coroutine-unevaluate.cpp
+++ b/clang/test/SemaCXX/coroutine-unevaluate.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -Wno-coroutines-unsupported-target
#include "Inputs/std-coroutine.h"
struct MyTask{
diff --git a/clang/test/SemaCXX/coroutine-vla.cpp b/clang/test/SemaCXX/coroutine-vla.cpp
index 996c89025e2ad..614f76b5d8c07 100644
--- a/clang/test/SemaCXX/coroutine-vla.cpp
+++ b/clang/test/SemaCXX/coroutine-vla.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -Wno-vla-cxx-extension -verify
+// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -Wno-vla-cxx-extension -Wno-coroutines-unsupported-target -verify
#include "Inputs/std-coroutine.h"
struct promise;
diff --git a/clang/test/SemaCXX/coroutine-win32x86.cpp b/clang/test/SemaCXX/coroutine-win32x86.cpp
new file mode 100644
index 0000000000000..1d91d8263514c
--- /dev/null
+++ b/clang/test/SemaCXX/coroutine-win32x86.cpp
@@ -0,0 +1,35 @@
+namespace std {
+template <typename... T> struct coroutine_traits;
+
+template <class Promise = void> struct coroutine_handle {
+ coroutine_handle() = default;
+ static coroutine_handle from_address(void *) noexcept;
+};
+template <> struct coroutine_handle<void> {
+ static coroutine_handle from_address(void *) noexcept;
+ coroutine_handle() = default;
+ template <class PromiseType>
+ coroutine_handle(coroutine_handle<PromiseType>) noexcept;
+};
+} // namespace std
+
+struct suspend_always {
+ bool await_ready() noexcept;
+ void await_suspend(std::coroutine_handle<>) noexcept;
+ void await_resume() noexcept;
+};
+
+template <> struct std::coroutine_traits<void> {
+ struct promise_type {
+ void get_return_object() noexcept;
+ suspend_always initial_suspend() noexcept;
+ suspend_always final_suspend() noexcept;
+ void return_void() noexcept;
+ void unhandled_exception() noexcept;
+ };
+};
+
+
+void f() {
+ co_return; // expected-warning {{coroutines support when targeting the 32 bits x86 Microsoft ABI is experimental and incomplete [-Wcoroutines-unsupported-target]}}
+}
diff --git a/clang/test/SemaCXX/coroutine_handle-address-return-type.cpp b/clang/test/SemaCXX/coroutine_handle-address-return-type.cpp
index 884ff3680e1a1..50e583d222018 100644
--- a/clang/test/SemaCXX/coroutine_handle-address-return-type.cpp
+++ b/clang/test/SemaCXX/coroutine_handle-address-return-type.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify %s -stdlib=libc++ -std=c++20 -fsyntax-only
+// RUN: %clang_cc1 -verify %s -stdlib=libc++ -std=c++20 -fsyntax-only -Wno-coroutines-unsupported-target
namespace std {
template <class Promise = void>
diff --git a/clang/test/SemaCXX/coroutines.cpp b/clang/test/SemaCXX/coroutines.cpp
index dcb670ea13173..4cef2f2b7ea0f 100644
--- a/clang/test/SemaCXX/coroutines.cpp
+++ b/clang/test/SemaCXX/coroutines.cpp
@@ -1,8 +1,8 @@
// This file contains references to sections of the Coroutines TS, which can be
// found at http://wg21.link/coroutines.
-// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fcxx-exceptions -fexceptions -Wunused-result
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23 %s -fcxx-exceptions -fexceptions -Wunused-result
+// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fcxx-exceptions -fexceptions -Wunused-result -Wno-coroutines-unsupported-target
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23 %s -fcxx-exceptions -fexceptions -Wunused-result -Wno-coroutines-unsupported-target
// Run without -verify to check the order of errors we show.
// RUN: not %clang_cc1 -std=c++20 -fsyntax-only %s -fcxx-exceptions -fexceptions -Wunused-result 2>&1 | FileCheck %s
diff --git a/clang/test/SemaCXX/cxx20-delayed-typo-correction-crashes.cpp b/clang/test/SemaCXX/cxx20-delayed-typo-correction-crashes.cpp
index a16a7f8255f7c..7249e348b7201 100644
--- a/clang/test/SemaCXX/cxx20-delayed-typo-correction-crashes.cpp
+++ b/clang/test/SemaCXX/cxx20-delayed-typo-correction-crashes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s -Wno-coroutines-unsupported-target
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/SemaCXX/cxx2b-deducing-this-coro.cpp b/clang/test/SemaCXX/cxx2b-deducing-this-coro.cpp
index dfa50cb75acfa..88d95caf02563 100644
--- a/clang/test/SemaCXX/cxx2b-deducing-this-coro.cpp
+++ b/clang/test/SemaCXX/cxx2b-deducing-this-coro.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++2b %s -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++2b %s -fsyntax-only -verify -Wno-coroutines-unsupported-target
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/SemaCXX/thread-safety-coro.cpp b/clang/test/SemaCXX/thread-safety-coro.cpp
index 349efcfa7eb05..34cd0f8ad1777 100644
--- a/clang/test/SemaCXX/thread-safety-coro.cpp
+++ b/clang/test/SemaCXX/thread-safety-coro.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++20 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++20 %s -Wno-coroutines-unsupported-target
// expected-no-diagnostics
diff --git a/clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp b/clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp
index e96aae4fefc6b..7c8364c96aecc 100644
--- a/clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp
+++ b/clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++20 %s -fcxx-exceptions -fsyntax-only -Wexceptions -verify -fdeclspec
+// RUN: %clang_cc1 -std=c++20 %s -fcxx-exceptions -fsyntax-only -Wexceptions -Wno-coroutines-unsupported-target -verify -fdeclspec
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/SemaCXX/warn-unsequenced-coro.cpp b/clang/test/SemaCXX/warn-unsequenced-coro.cpp
index 56d2edcf30155..79446be9af439 100644
--- a/clang/test/SemaCXX/warn-unsequenced-coro.cpp
+++ b/clang/test/SemaCXX/warn-unsequenced-coro.cpp
@@ -102,4 +102,4 @@ generator<int> range(int start, int end)
Task<int> go(int const& val);
Task<int> go1(int x) {
co_return co_await go(++x);
-}
\ No newline at end of file
+}
diff --git a/clang/test/SemaCXX/warn-unused-parameters-coroutine.cpp b/clang/test/SemaCXX/warn-unused-parameters-coroutine.cpp
index b4c01550f9f78..fee379d869112 100644
--- a/clang/test/SemaCXX/warn-unused-parameters-coroutine.cpp
+++ b/clang/test/SemaCXX/warn-unused-parameters-coroutine.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -verify -std=c++20 %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -verify -std=c++20 -Wno-coroutines-unsupported-target %s
#include "Inputs/std-coroutine.h"
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 2c834b07f9a8f..0623bac3e5ee4 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -994,8 +994,9 @@ <h2 id="cxx20">C++20 implementation status</h2>
<td><a href="https://wg21.link/p0912r5">P0912R5</a></td>
<td class="partial" align="center">
<details><summary>Partial</summary>
- Fully supported on all targets except Windows, which
- still has some stability and ABI issues.
+ Fully supported on all targets except Windows, which still has some stability and ABI issues.
+ On 32 bits windows, the <code>__cpp_impl_coroutine</code> feature macro is not defined,
+ and a warning is emitted when using coroutines.
</details></td>
</tr>
<!-- Cologne 2019 papers -->
More information about the cfe-commits
mailing list