[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / coroutine-seh.cpp
blob6e778d998881047f53f4e4245911b559ff2a3bde
1 // RUN: %clang_cc1 -std=c++20 -verify %s -fcxx-exceptions -fexceptions -triple x86_64-windows-msvc -fms-extensions
2 namespace std {
3 template <typename... T> struct coroutine_traits;
5 template <class Promise = void> struct coroutine_handle {
6 coroutine_handle() = default;
7 static coroutine_handle from_address(void *) noexcept;
8 };
9 template <> struct coroutine_handle<void> {
10 static coroutine_handle from_address(void *) noexcept;
11 coroutine_handle() = default;
12 template <class PromiseType>
13 coroutine_handle(coroutine_handle<PromiseType>) noexcept;
15 } // namespace std
17 struct suspend_always {
18 bool await_ready() noexcept;
19 void await_suspend(std::coroutine_handle<>) noexcept;
20 void await_resume() noexcept;
23 template <> struct std::coroutine_traits<void> {
24 struct promise_type {
25 void get_return_object() noexcept;
26 suspend_always initial_suspend() noexcept;
27 suspend_always final_suspend() noexcept;
28 void return_void() noexcept;
29 void unhandled_exception() noexcept;
33 void SEH_used() {
34 __try { // expected-error {{cannot use SEH '__try' in a coroutine when C++ exceptions are enabled}}
35 co_return; // expected-note {{function is a coroutine due to use of 'co_return' here}}
36 } __except(0) {}