38 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -verify %s -fcxx-exceptions -fexceptions -triple x86_64-windows-msvc -fms-extensions2namespace std {3template <typename... T> struct coroutine_traits;4 5template <class Promise = void> struct coroutine_handle {6 coroutine_handle() = default;7 static coroutine_handle from_address(void *) noexcept;8};9template <> 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;14};15} // namespace std16 17struct suspend_always {18 bool await_ready() noexcept;19 void await_suspend(std::coroutine_handle<>) noexcept;20 void await_resume() noexcept;21};22 23template <> 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;30 };31};32 33void 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) {}37}38