2017-05-23 06:33:17 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++1z -fcoroutines-ts -verify %s -fcxx-exceptions -fexceptions -triple x86_64-windows-msvc -fms-extensions
|
2021-09-04 04:01:09 +08:00
|
|
|
namespace std::experimental {
|
2017-05-23 06:33:17 +08:00
|
|
|
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;
|
|
|
|
};
|
2021-09-04 04:01:09 +08:00
|
|
|
}
|
2017-05-23 06:33:17 +08:00
|
|
|
|
|
|
|
struct suspend_always {
|
|
|
|
bool await_ready() noexcept;
|
2021-09-04 04:01:09 +08:00
|
|
|
void await_suspend(std::experimental::coroutine_handle<>) noexcept;
|
2017-05-23 06:33:17 +08:00
|
|
|
void await_resume() noexcept;
|
|
|
|
};
|
|
|
|
|
2021-09-04 04:01:09 +08:00
|
|
|
template <> struct std::experimental::coroutine_traits<void> {
|
2017-05-23 06:33:17 +08:00
|
|
|
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 SEH_used() {
|
|
|
|
__try { // expected-error {{cannot use SEH '__try' in a coroutine when C++ exceptions are enabled}}
|
|
|
|
co_return; // expected-note {{function is a coroutine due to use of 'co_return' here}}
|
|
|
|
} __except(0) {}
|
|
|
|
}
|