<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55896>55896</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
-Wthread-safety co_yield/co_await crash
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
urnathan
</td>
</tr>
</table>
<pre>
Like 55406, co_yield and co_await crash. Their implementations are somewhat different to co_return.
```
namespace std {
template <typename _Result, typename...>
struct coroutine_traits {
using promise_type = typename _Result::promise_type;
};
template <typename _Promise = void>
struct coroutine_handle;
template <>
struct coroutine_handle<void> {
static coroutine_handle from_address(void *__a) noexcept;
void resume() const noexcept;
void destroy() const noexcept;
};
template <typename _Promise>
struct coroutine_handle : coroutine_handle<> {};
struct suspend_always {
bool await_ready() const noexcept;
void await_suspend(coroutine_handle<>) const noexcept;
void await_resume() const noexcept;
};
} // namespace std
class Task {
public:
struct promise_type {
public:
std::suspend_always initial_suspend() noexcept;
std::suspend_always final_suspend() noexcept;
Task get_return_object() noexcept;
void unhandled_exception() noexcept;
void return_value(int value) noexcept;
std::suspend_always yield_value(int value) noexcept;
};
};
Task Foo() noexcept {
// ICE'd
#if !ONLY_COAWAIT
co_yield({ int frame = 0; 0; });
#endif
co_await({ int frame = 0; std::suspend_always(); });
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVU1vozAQ_TVwsYooBEgOHNJkI1WqtqtVpdWekMFD8NbgyDbt5t_v2JDmq0m6Ekownnnz5s2MXUq2zZ_4K5AkmYSpFy1IJYstB8EI7Zhd0HfKDakU1U1AyEsDXBHebgS00BlquOw0oQqIli28N9QQxusaFG4SIy2AAtOrLvDCpRfOvTQcH7fsaAt6Qyt0N4x42cPw2QAGoAaIFy_MdgPWjBQ_QffCWI67b0EQePG3wUcb1VdIVCrZG95BYRQS13tQQnrNuzXZKNlyjfsIggGW5CxCPMfn0MyLRwwvW-7fr1D9MTg7-DfJ2WWWDcos4ArobdfFGOEwVW1LU50ZkxqJFZQxBVp70dR6Ei-aFwX1ohnpJPytYGM-6BDHnqB13wLaW6MKK24umjJAnnJ73fY_ZbwlATrNP9Nlp8lZtBFH9xojsYKKd7o96pRSSkFc52P7UnYjnTH1wX4ERY_PGX0V5yuaH2WWLbGSK3zI0VQd5l0JqjV5ofp1n-ymLwWvbM9_tI4T53hM9tKc2RMXxc3MiaC844ZTcSDJhSa7DFHz7jbAHsaltgYzHjqFLP9AZa4Fdor33VAhVgwWeKjd9BkjvFHR2ypxPO_G96sMLyXqztwvohFyUviTOE6FlZQnORxWceyUxwX2Y7brkSjmNe7cP39_-l0snue_5o8vO4fdtWAxswdiCdbKDqk94kIkMPxYMtFszyeKMUdeH6C47r6MckGfIZXPIuDy-GbxWR6zWTyjvuFGQH73yzR2iO80rcFsDzJZHV9vfq9E3hiz0ZaBE2jNTdOXQSVbXAjxtvu7w-kYOmvFte4B-a2SZDpL_SYPq5QlWRZFAPeUxXWYMjadxJCl6TSNqswXtAShcy958JKlz_MojKIwDdP7KAzDNEiSWZxOgGbRJCyzJPUmIbSUi8AGDqRa-yp3HMp-rXFTcG30fhMnnK87gB0-7U0jVY69Sg12ue_45o7sP-CdfBA">