16219b7c6SDeniz Evrenci // RUN: %check_clang_tidy -std=c++20 %s bugprone-exception-escape %t -- \
26219b7c6SDeniz Evrenci // RUN: -- -fexceptions
36219b7c6SDeniz Evrenci
46219b7c6SDeniz Evrenci namespace std {
56219b7c6SDeniz Evrenci
66219b7c6SDeniz Evrenci template <class Ret, typename... T> struct coroutine_traits {
76219b7c6SDeniz Evrenci using promise_type = typename Ret::promise_type;
86219b7c6SDeniz Evrenci };
96219b7c6SDeniz Evrenci
106219b7c6SDeniz Evrenci template <class Promise = void> struct coroutine_handle {
116219b7c6SDeniz Evrenci static coroutine_handle from_address(void *) noexcept;
126219b7c6SDeniz Evrenci static coroutine_handle from_promise(Promise &promise);
136219b7c6SDeniz Evrenci constexpr void *address() const noexcept;
146219b7c6SDeniz Evrenci };
156219b7c6SDeniz Evrenci
166219b7c6SDeniz Evrenci template <> struct coroutine_handle<void> {
176219b7c6SDeniz Evrenci template <class PromiseType>
186219b7c6SDeniz Evrenci coroutine_handle(coroutine_handle<PromiseType>) noexcept;
196219b7c6SDeniz Evrenci static coroutine_handle from_address(void *);
206219b7c6SDeniz Evrenci constexpr void *address() const noexcept;
216219b7c6SDeniz Evrenci };
226219b7c6SDeniz Evrenci
236219b7c6SDeniz Evrenci struct suspend_always {
await_readystd::suspend_always246219b7c6SDeniz Evrenci bool await_ready() noexcept { return false; }
await_suspendstd::suspend_always256219b7c6SDeniz Evrenci void await_suspend(coroutine_handle<>) noexcept {}
await_resumestd::suspend_always266219b7c6SDeniz Evrenci void await_resume() noexcept {}
276219b7c6SDeniz Evrenci };
286219b7c6SDeniz Evrenci
296219b7c6SDeniz Evrenci struct suspend_never {
await_readystd::suspend_never306219b7c6SDeniz Evrenci bool await_ready() noexcept { return true; }
await_suspendstd::suspend_never316219b7c6SDeniz Evrenci void await_suspend(coroutine_handle<>) noexcept {}
await_resumestd::suspend_never326219b7c6SDeniz Evrenci void await_resume() noexcept {}
336219b7c6SDeniz Evrenci };
346219b7c6SDeniz Evrenci
356219b7c6SDeniz Evrenci } // namespace std
366219b7c6SDeniz Evrenci
376219b7c6SDeniz Evrenci template <typename Task, typename T, bool ThrowInPromiseConstructor,
386219b7c6SDeniz Evrenci bool ThrowInInitialSuspend, bool ThrowInGetReturnObject,
39*daac014fSDeniz Evrenci bool ThrowInUnhandledException, bool RethrowInUnhandledException>
406219b7c6SDeniz Evrenci struct Promise;
416219b7c6SDeniz Evrenci
426219b7c6SDeniz Evrenci template <
436219b7c6SDeniz Evrenci typename T, bool ThrowInTaskConstructor = false,
446219b7c6SDeniz Evrenci bool ThrowInPromiseConstructor = false, bool ThrowInInitialSuspend = false,
45*daac014fSDeniz Evrenci bool ThrowInGetReturnObject = false, bool ThrowInUnhandledException = false,
46*daac014fSDeniz Evrenci bool RethrowInUnhandledException = false>
476219b7c6SDeniz Evrenci struct Task {
486219b7c6SDeniz Evrenci using promise_type =
496219b7c6SDeniz Evrenci Promise<Task, T, ThrowInPromiseConstructor, ThrowInInitialSuspend,
50*daac014fSDeniz Evrenci ThrowInGetReturnObject, ThrowInUnhandledException, RethrowInUnhandledException>;
516219b7c6SDeniz Evrenci
TaskTask526219b7c6SDeniz Evrenci explicit Task(promise_type &p) {
536219b7c6SDeniz Evrenci if constexpr (ThrowInTaskConstructor) {
546219b7c6SDeniz Evrenci throw 1;
556219b7c6SDeniz Evrenci }
566219b7c6SDeniz Evrenci
576219b7c6SDeniz Evrenci p.return_val = this;
586219b7c6SDeniz Evrenci }
596219b7c6SDeniz Evrenci
await_readyTask606219b7c6SDeniz Evrenci bool await_ready() { return true; }
616219b7c6SDeniz Evrenci
await_suspendTask626219b7c6SDeniz Evrenci void await_suspend(std::coroutine_handle<> h) {}
636219b7c6SDeniz Evrenci
await_resumeTask646219b7c6SDeniz Evrenci void await_resume() {}
656219b7c6SDeniz Evrenci
666219b7c6SDeniz Evrenci T value;
676219b7c6SDeniz Evrenci };
686219b7c6SDeniz Evrenci
696219b7c6SDeniz Evrenci template <bool ThrowInTaskConstructor, bool ThrowInPromiseConstructor,
706219b7c6SDeniz Evrenci bool ThrowInInitialSuspend, bool ThrowInGetReturnObject,
71*daac014fSDeniz Evrenci bool ThrowInUnhandledException, bool RethrowInUnhandledException>
726219b7c6SDeniz Evrenci struct Task<void, ThrowInTaskConstructor, ThrowInPromiseConstructor,
736219b7c6SDeniz Evrenci ThrowInInitialSuspend, ThrowInGetReturnObject,
74*daac014fSDeniz Evrenci ThrowInUnhandledException, RethrowInUnhandledException> {
756219b7c6SDeniz Evrenci using promise_type =
766219b7c6SDeniz Evrenci Promise<Task, void, ThrowInPromiseConstructor, ThrowInInitialSuspend,
77*daac014fSDeniz Evrenci ThrowInGetReturnObject, ThrowInUnhandledException, RethrowInUnhandledException>;
786219b7c6SDeniz Evrenci
TaskTask796219b7c6SDeniz Evrenci explicit Task(promise_type &p) {
806219b7c6SDeniz Evrenci if constexpr (ThrowInTaskConstructor) {
816219b7c6SDeniz Evrenci throw 1;
826219b7c6SDeniz Evrenci }
836219b7c6SDeniz Evrenci
846219b7c6SDeniz Evrenci p.return_val = this;
856219b7c6SDeniz Evrenci }
866219b7c6SDeniz Evrenci
await_readyTask876219b7c6SDeniz Evrenci bool await_ready() { return true; }
886219b7c6SDeniz Evrenci
await_suspendTask896219b7c6SDeniz Evrenci void await_suspend(std::coroutine_handle<> h) {}
906219b7c6SDeniz Evrenci
await_resumeTask916219b7c6SDeniz Evrenci void await_resume() {}
926219b7c6SDeniz Evrenci };
936219b7c6SDeniz Evrenci
946219b7c6SDeniz Evrenci template <typename Task, typename T, bool ThrowInPromiseConstructor,
956219b7c6SDeniz Evrenci bool ThrowInInitialSuspend, bool ThrowInGetReturnObject,
96*daac014fSDeniz Evrenci bool ThrowInUnhandledException, bool RethrowInUnhandledException>
976219b7c6SDeniz Evrenci struct Promise {
PromisePromise986219b7c6SDeniz Evrenci Promise() {
996219b7c6SDeniz Evrenci if constexpr (ThrowInPromiseConstructor) {
1006219b7c6SDeniz Evrenci throw 1;
1016219b7c6SDeniz Evrenci }
1026219b7c6SDeniz Evrenci }
1036219b7c6SDeniz Evrenci
get_return_objectPromise1046219b7c6SDeniz Evrenci Task get_return_object() {
1056219b7c6SDeniz Evrenci if constexpr (ThrowInGetReturnObject) {
1066219b7c6SDeniz Evrenci throw 1;
1076219b7c6SDeniz Evrenci }
1086219b7c6SDeniz Evrenci
1096219b7c6SDeniz Evrenci return Task{*this};
1106219b7c6SDeniz Evrenci }
1116219b7c6SDeniz Evrenci
initial_suspendPromise1126219b7c6SDeniz Evrenci std::suspend_never initial_suspend() const {
1136219b7c6SDeniz Evrenci if constexpr (ThrowInInitialSuspend) {
1146219b7c6SDeniz Evrenci throw 1;
1156219b7c6SDeniz Evrenci }
1166219b7c6SDeniz Evrenci
1176219b7c6SDeniz Evrenci return {};
1186219b7c6SDeniz Evrenci }
1196219b7c6SDeniz Evrenci
final_suspendPromise1206219b7c6SDeniz Evrenci std::suspend_never final_suspend() const noexcept { return {}; }
1216219b7c6SDeniz Evrenci
return_valuePromise1226219b7c6SDeniz Evrenci template <typename U> void return_value(U &&val) {
1236219b7c6SDeniz Evrenci return_val->value = static_cast<U &&>(val);
1246219b7c6SDeniz Evrenci }
1256219b7c6SDeniz Evrenci
yield_valuePromise1266219b7c6SDeniz Evrenci template <typename U> std::suspend_never yield_value(U &&val) {
1276219b7c6SDeniz Evrenci return_val->value = static_cast<U &&>(val);
1286219b7c6SDeniz Evrenci return {};
1296219b7c6SDeniz Evrenci }
1306219b7c6SDeniz Evrenci
unhandled_exceptionPromise1316219b7c6SDeniz Evrenci void unhandled_exception() {
1326219b7c6SDeniz Evrenci if constexpr (ThrowInUnhandledException) {
1336219b7c6SDeniz Evrenci throw 1;
134*daac014fSDeniz Evrenci } else if constexpr (RethrowInUnhandledException) {
135*daac014fSDeniz Evrenci throw;
1366219b7c6SDeniz Evrenci }
1376219b7c6SDeniz Evrenci }
1386219b7c6SDeniz Evrenci
1396219b7c6SDeniz Evrenci Task *return_val;
1406219b7c6SDeniz Evrenci };
1416219b7c6SDeniz Evrenci
1426219b7c6SDeniz Evrenci template <typename Task, bool ThrowInPromiseConstructor,
1436219b7c6SDeniz Evrenci bool ThrowInInitialSuspend, bool ThrowInGetReturnObject,
144*daac014fSDeniz Evrenci bool ThrowInUnhandledException, bool RethrowInUnhandledException>
1456219b7c6SDeniz Evrenci struct Promise<Task, void, ThrowInPromiseConstructor, ThrowInInitialSuspend,
146*daac014fSDeniz Evrenci ThrowInGetReturnObject, ThrowInUnhandledException, RethrowInUnhandledException> {
PromisePromise1476219b7c6SDeniz Evrenci Promise() {
1486219b7c6SDeniz Evrenci if constexpr (ThrowInPromiseConstructor) {
1496219b7c6SDeniz Evrenci throw 1;
1506219b7c6SDeniz Evrenci }
1516219b7c6SDeniz Evrenci }
1526219b7c6SDeniz Evrenci
get_return_objectPromise1536219b7c6SDeniz Evrenci Task get_return_object() {
1546219b7c6SDeniz Evrenci if constexpr (ThrowInGetReturnObject) {
1556219b7c6SDeniz Evrenci throw 1;
1566219b7c6SDeniz Evrenci }
1576219b7c6SDeniz Evrenci
1586219b7c6SDeniz Evrenci return Task{*this};
1596219b7c6SDeniz Evrenci }
1606219b7c6SDeniz Evrenci
initial_suspendPromise1616219b7c6SDeniz Evrenci std::suspend_never initial_suspend() const {
1626219b7c6SDeniz Evrenci if constexpr (ThrowInInitialSuspend) {
1636219b7c6SDeniz Evrenci throw 1;
1646219b7c6SDeniz Evrenci }
1656219b7c6SDeniz Evrenci
1666219b7c6SDeniz Evrenci return {};
1676219b7c6SDeniz Evrenci }
1686219b7c6SDeniz Evrenci
final_suspendPromise1696219b7c6SDeniz Evrenci std::suspend_never final_suspend() const noexcept { return {}; }
1706219b7c6SDeniz Evrenci
return_voidPromise1716219b7c6SDeniz Evrenci void return_void() {}
1726219b7c6SDeniz Evrenci
unhandled_exceptionPromise1736219b7c6SDeniz Evrenci void unhandled_exception() {
1746219b7c6SDeniz Evrenci if constexpr (ThrowInUnhandledException) {
1756219b7c6SDeniz Evrenci throw 1;
176*daac014fSDeniz Evrenci } else if constexpr (RethrowInUnhandledException) {
177*daac014fSDeniz Evrenci throw;
1786219b7c6SDeniz Evrenci }
1796219b7c6SDeniz Evrenci }
1806219b7c6SDeniz Evrenci
1816219b7c6SDeniz Evrenci Task *return_val;
1826219b7c6SDeniz Evrenci };
1836219b7c6SDeniz Evrenci
1846219b7c6SDeniz Evrenci struct Evil {
~EvilEvil1856219b7c6SDeniz Evrenci ~Evil() noexcept(false) {
1866219b7c6SDeniz Evrenci throw 42;
1876219b7c6SDeniz Evrenci }
1886219b7c6SDeniz Evrenci };
1896219b7c6SDeniz Evrenci
returnOne()1906219b7c6SDeniz Evrenci Task<int> returnOne() { co_return 1; }
1916219b7c6SDeniz Evrenci
1926219b7c6SDeniz Evrenci namespace function {
1936219b7c6SDeniz Evrenci
1946219b7c6SDeniz Evrenci namespace coreturn {
1956219b7c6SDeniz Evrenci
a_ShouldNotDiag(const int a,const int b)1966219b7c6SDeniz Evrenci Task<int> a_ShouldNotDiag(const int a, const int b) {
1976219b7c6SDeniz Evrenci if (b == 0)
1986219b7c6SDeniz Evrenci throw b;
1996219b7c6SDeniz Evrenci
2006219b7c6SDeniz Evrenci co_return a / b;
2016219b7c6SDeniz Evrenci }
2026219b7c6SDeniz Evrenci
b_ShouldNotDiag(const int a,const int b)2036219b7c6SDeniz Evrenci Task<int> b_ShouldNotDiag(const int a, const int b) noexcept {
2046219b7c6SDeniz Evrenci if (b == 0)
2056219b7c6SDeniz Evrenci throw b;
2066219b7c6SDeniz Evrenci
2076219b7c6SDeniz Evrenci co_return a / b;
2086219b7c6SDeniz Evrenci }
2096219b7c6SDeniz Evrenci
c_ShouldNotDiag(const int a,const int b)2106219b7c6SDeniz Evrenci Task<int> c_ShouldNotDiag(const int a, const int b) {
2116219b7c6SDeniz Evrenci if (b == 0)
2126219b7c6SDeniz Evrenci throw Evil{};
2136219b7c6SDeniz Evrenci
2146219b7c6SDeniz Evrenci co_return a / b;
2156219b7c6SDeniz Evrenci }
2166219b7c6SDeniz Evrenci
c_ShouldDiag(const int a,const int b)2176219b7c6SDeniz Evrenci Task<int> c_ShouldDiag(const int a, const int b) noexcept {
2186219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: an exception may be thrown in function 'c_ShouldDiag' which should not throw exceptions
2196219b7c6SDeniz Evrenci if (b == 0)
2206219b7c6SDeniz Evrenci throw Evil{};
2216219b7c6SDeniz Evrenci
2226219b7c6SDeniz Evrenci co_return a / b;
2236219b7c6SDeniz Evrenci }
2246219b7c6SDeniz Evrenci
d_ShouldNotDiag(const int a,const int b)2256219b7c6SDeniz Evrenci Task<int, true> d_ShouldNotDiag(const int a, const int b) {
2266219b7c6SDeniz Evrenci co_return a / b;
2276219b7c6SDeniz Evrenci }
2286219b7c6SDeniz Evrenci
d_ShouldDiag(const int a,const int b)2296219b7c6SDeniz Evrenci Task<int, true> d_ShouldDiag(const int a, const int b) noexcept {
2306219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: an exception may be thrown in function 'd_ShouldDiag' which should not throw exceptions
2316219b7c6SDeniz Evrenci co_return a / b;
2326219b7c6SDeniz Evrenci }
2336219b7c6SDeniz Evrenci
e_ShouldNotDiag(const int a,const int b)2346219b7c6SDeniz Evrenci Task<int, false, true> e_ShouldNotDiag(const int a, const int b) {
2356219b7c6SDeniz Evrenci co_return a / b;
2366219b7c6SDeniz Evrenci }
2376219b7c6SDeniz Evrenci
e_ShouldDiag(const int a,const int b)2386219b7c6SDeniz Evrenci Task<int, false, true> e_ShouldDiag(const int a, const int b) noexcept {
2396219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: an exception may be thrown in function 'e_ShouldDiag' which should not throw exceptions
2406219b7c6SDeniz Evrenci co_return a / b;
2416219b7c6SDeniz Evrenci }
2426219b7c6SDeniz Evrenci
f_ShouldNotDiag(const int a,const int b)2436219b7c6SDeniz Evrenci Task<int, false, false, true> f_ShouldNotDiag(const int a, const int b) {
2446219b7c6SDeniz Evrenci co_return a / b;
2456219b7c6SDeniz Evrenci }
2466219b7c6SDeniz Evrenci
f_ShouldDiag(const int a,const int b)2476219b7c6SDeniz Evrenci Task<int, false, false, true> f_ShouldDiag(const int a, const int b) noexcept {
2486219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: an exception may be thrown in function 'f_ShouldDiag' which should not throw exceptions
2496219b7c6SDeniz Evrenci co_return a / b;
2506219b7c6SDeniz Evrenci }
2516219b7c6SDeniz Evrenci
g_ShouldNotDiag(const int a,const int b)2526219b7c6SDeniz Evrenci Task<int, false, false, false, true> g_ShouldNotDiag(const int a, const int b) {
2536219b7c6SDeniz Evrenci co_return a / b;
2546219b7c6SDeniz Evrenci }
2556219b7c6SDeniz Evrenci
g_ShouldDiag(const int a,const int b)2566219b7c6SDeniz Evrenci Task<int, false, false, false, true> g_ShouldDiag(const int a,
2576219b7c6SDeniz Evrenci const int b) noexcept {
2586219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:38: warning: an exception may be thrown in function 'g_ShouldDiag' which should not throw exceptions
2596219b7c6SDeniz Evrenci co_return a / b;
2606219b7c6SDeniz Evrenci }
2616219b7c6SDeniz Evrenci
h_ShouldNotDiag(const int a,const int b)2626219b7c6SDeniz Evrenci Task<int, false, false, false, false, true> h_ShouldNotDiag(const int a,
2636219b7c6SDeniz Evrenci const int b) {
2646219b7c6SDeniz Evrenci co_return a / b;
2656219b7c6SDeniz Evrenci }
2666219b7c6SDeniz Evrenci
h_ShouldDiag(const int a,const int b)2676219b7c6SDeniz Evrenci Task<int, false, false, false, false, true> h_ShouldDiag(const int a,
2686219b7c6SDeniz Evrenci const int b) noexcept {
2696219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:45: warning: an exception may be thrown in function 'h_ShouldDiag' which should not throw exceptions
2706219b7c6SDeniz Evrenci co_return a / b;
2716219b7c6SDeniz Evrenci }
2726219b7c6SDeniz Evrenci
273*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
i_ShouldNotDiag(const int a,const int b)274*daac014fSDeniz Evrenci i_ShouldNotDiag(const int a, const int b) {
275*daac014fSDeniz Evrenci co_return a / b;
276*daac014fSDeniz Evrenci }
277*daac014fSDeniz Evrenci
278*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
i_ShouldNotDiagNoexcept(const int a,const int b)279*daac014fSDeniz Evrenci i_ShouldNotDiagNoexcept(const int a, const int b) noexcept {
280*daac014fSDeniz Evrenci co_return a / b;
281*daac014fSDeniz Evrenci }
282*daac014fSDeniz Evrenci
283*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
j_ShouldNotDiag(const int a,const int b)284*daac014fSDeniz Evrenci j_ShouldNotDiag(const int a, const int b) {
285*daac014fSDeniz Evrenci if (b == 0)
286*daac014fSDeniz Evrenci throw b;
287*daac014fSDeniz Evrenci
288*daac014fSDeniz Evrenci co_return a / b;
289*daac014fSDeniz Evrenci }
290*daac014fSDeniz Evrenci
291*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
j_ShouldDiag(const int a,const int b)292*daac014fSDeniz Evrenci j_ShouldDiag(const int a, const int b) noexcept {
293*daac014fSDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: an exception may be thrown in function 'j_ShouldDiag' which should not throw exceptions
294*daac014fSDeniz Evrenci if (b == 0)
295*daac014fSDeniz Evrenci throw b;
296*daac014fSDeniz Evrenci
297*daac014fSDeniz Evrenci co_return a / b;
298*daac014fSDeniz Evrenci }
299*daac014fSDeniz Evrenci
3006219b7c6SDeniz Evrenci } // namespace coreturn
3016219b7c6SDeniz Evrenci
3026219b7c6SDeniz Evrenci namespace coyield {
3036219b7c6SDeniz Evrenci
a_ShouldNotDiag(const int a,const int b)3046219b7c6SDeniz Evrenci Task<int> a_ShouldNotDiag(const int a, const int b) {
3056219b7c6SDeniz Evrenci if (b == 0)
3066219b7c6SDeniz Evrenci throw b;
3076219b7c6SDeniz Evrenci
3086219b7c6SDeniz Evrenci co_yield a / b;
3096219b7c6SDeniz Evrenci }
3106219b7c6SDeniz Evrenci
b_ShouldNotDiag(const int a,const int b)3116219b7c6SDeniz Evrenci Task<int> b_ShouldNotDiag(const int a, const int b) noexcept {
3126219b7c6SDeniz Evrenci if (b == 0)
3136219b7c6SDeniz Evrenci throw b;
3146219b7c6SDeniz Evrenci
3156219b7c6SDeniz Evrenci co_yield a / b;
3166219b7c6SDeniz Evrenci }
3176219b7c6SDeniz Evrenci
c_ShouldNotDiag(const int a,const int b)3186219b7c6SDeniz Evrenci Task<int> c_ShouldNotDiag(const int a, const int b) {
3196219b7c6SDeniz Evrenci if (b == 0)
3206219b7c6SDeniz Evrenci throw Evil{};
3216219b7c6SDeniz Evrenci
3226219b7c6SDeniz Evrenci co_yield a / b;
3236219b7c6SDeniz Evrenci }
3246219b7c6SDeniz Evrenci
c_ShouldDiag(const int a,const int b)3256219b7c6SDeniz Evrenci Task<int> c_ShouldDiag(const int a, const int b) noexcept {
3266219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: an exception may be thrown in function 'c_ShouldDiag' which should not throw exceptions
3276219b7c6SDeniz Evrenci if (b == 0)
3286219b7c6SDeniz Evrenci throw Evil{};
3296219b7c6SDeniz Evrenci
3306219b7c6SDeniz Evrenci co_yield a / b;
3316219b7c6SDeniz Evrenci }
3326219b7c6SDeniz Evrenci
d_ShouldNotDiag(const int a,const int b)3336219b7c6SDeniz Evrenci Task<int, true> d_ShouldNotDiag(const int a, const int b) {
3346219b7c6SDeniz Evrenci co_yield a / b;
3356219b7c6SDeniz Evrenci }
3366219b7c6SDeniz Evrenci
d_ShouldDiag(const int a,const int b)3376219b7c6SDeniz Evrenci Task<int, true> d_ShouldDiag(const int a, const int b) noexcept {
3386219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: an exception may be thrown in function 'd_ShouldDiag' which should not throw exceptions
3396219b7c6SDeniz Evrenci co_yield a / b;
3406219b7c6SDeniz Evrenci }
3416219b7c6SDeniz Evrenci
e_ShouldNotDiag(const int a,const int b)3426219b7c6SDeniz Evrenci Task<int, false, true> e_ShouldNotDiag(const int a, const int b) {
3436219b7c6SDeniz Evrenci co_yield a / b;
3446219b7c6SDeniz Evrenci }
3456219b7c6SDeniz Evrenci
e_ShouldDiag(const int a,const int b)3466219b7c6SDeniz Evrenci Task<int, false, true> e_ShouldDiag(const int a, const int b) noexcept {
3476219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: an exception may be thrown in function 'e_ShouldDiag' which should not throw exceptions
3486219b7c6SDeniz Evrenci co_yield a / b;
3496219b7c6SDeniz Evrenci }
3506219b7c6SDeniz Evrenci
f_ShouldNotDiag(const int a,const int b)3516219b7c6SDeniz Evrenci Task<int, false, false, true> f_ShouldNotDiag(const int a, const int b) {
3526219b7c6SDeniz Evrenci co_yield a / b;
3536219b7c6SDeniz Evrenci }
3546219b7c6SDeniz Evrenci
f_ShouldDiag(const int a,const int b)3556219b7c6SDeniz Evrenci Task<int, false, false, true> f_ShouldDiag(const int a, const int b) noexcept {
3566219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: an exception may be thrown in function 'f_ShouldDiag' which should not throw exceptions
3576219b7c6SDeniz Evrenci co_yield a / b;
3586219b7c6SDeniz Evrenci }
3596219b7c6SDeniz Evrenci
g_ShouldNotDiag(const int a,const int b)3606219b7c6SDeniz Evrenci Task<int, false, false, false, true> g_ShouldNotDiag(const int a, const int b) {
3616219b7c6SDeniz Evrenci co_yield a / b;
3626219b7c6SDeniz Evrenci }
3636219b7c6SDeniz Evrenci
g_ShouldDiag(const int a,const int b)3646219b7c6SDeniz Evrenci Task<int, false, false, false, true> g_ShouldDiag(const int a,
3656219b7c6SDeniz Evrenci const int b) noexcept {
3666219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:38: warning: an exception may be thrown in function 'g_ShouldDiag' which should not throw exceptions
3676219b7c6SDeniz Evrenci co_yield a / b;
3686219b7c6SDeniz Evrenci }
3696219b7c6SDeniz Evrenci
h_ShouldNotDiag(const int a,const int b)3706219b7c6SDeniz Evrenci Task<int, false, false, false, false, true> h_ShouldNotDiag(const int a,
3716219b7c6SDeniz Evrenci const int b) {
3726219b7c6SDeniz Evrenci co_yield a / b;
3736219b7c6SDeniz Evrenci }
3746219b7c6SDeniz Evrenci
h_ShouldDiag(const int a,const int b)3756219b7c6SDeniz Evrenci Task<int, false, false, false, false, true> h_ShouldDiag(const int a,
3766219b7c6SDeniz Evrenci const int b) noexcept {
3776219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:45: warning: an exception may be thrown in function 'h_ShouldDiag' which should not throw exceptions
3786219b7c6SDeniz Evrenci co_yield a / b;
3796219b7c6SDeniz Evrenci }
3806219b7c6SDeniz Evrenci
381*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
i_ShouldNotDiag(const int a,const int b)382*daac014fSDeniz Evrenci i_ShouldNotDiag(const int a, const int b) {
383*daac014fSDeniz Evrenci co_yield a / b;
384*daac014fSDeniz Evrenci }
385*daac014fSDeniz Evrenci
386*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
i_ShouldNotDiagNoexcept(const int a,const int b)387*daac014fSDeniz Evrenci i_ShouldNotDiagNoexcept(const int a, const int b) noexcept {
388*daac014fSDeniz Evrenci co_yield a / b;
389*daac014fSDeniz Evrenci }
390*daac014fSDeniz Evrenci
391*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
j_ShouldNotDiag(const int a,const int b)392*daac014fSDeniz Evrenci j_ShouldNotDiag(const int a, const int b) {
393*daac014fSDeniz Evrenci if (b == 0)
394*daac014fSDeniz Evrenci throw b;
395*daac014fSDeniz Evrenci
396*daac014fSDeniz Evrenci co_yield a / b;
397*daac014fSDeniz Evrenci }
398*daac014fSDeniz Evrenci
399*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
j_ShouldDiag(const int a,const int b)400*daac014fSDeniz Evrenci j_ShouldDiag(const int a, const int b) noexcept {
401*daac014fSDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: an exception may be thrown in function 'j_ShouldDiag' which should not throw exceptions
402*daac014fSDeniz Evrenci if (b == 0)
403*daac014fSDeniz Evrenci throw b;
404*daac014fSDeniz Evrenci
405*daac014fSDeniz Evrenci co_yield a / b;
406*daac014fSDeniz Evrenci }
407*daac014fSDeniz Evrenci
4086219b7c6SDeniz Evrenci } // namespace coyield
4096219b7c6SDeniz Evrenci
4106219b7c6SDeniz Evrenci namespace coawait {
4116219b7c6SDeniz Evrenci
a_ShouldNotDiag(const int a,const int b)4126219b7c6SDeniz Evrenci Task<void> a_ShouldNotDiag(const int a, const int b) {
4136219b7c6SDeniz Evrenci if (b == 0)
4146219b7c6SDeniz Evrenci throw b;
4156219b7c6SDeniz Evrenci
4166219b7c6SDeniz Evrenci co_await returnOne();
4176219b7c6SDeniz Evrenci }
4186219b7c6SDeniz Evrenci
b_ShouldNotDiag(const int a,const int b)4196219b7c6SDeniz Evrenci Task<void> b_ShouldNotDiag(const int a, const int b) noexcept {
4206219b7c6SDeniz Evrenci if (b == 0)
4216219b7c6SDeniz Evrenci throw b;
4226219b7c6SDeniz Evrenci
4236219b7c6SDeniz Evrenci co_await returnOne();
4246219b7c6SDeniz Evrenci }
4256219b7c6SDeniz Evrenci
c_ShouldNotDiag(const int a,const int b)4266219b7c6SDeniz Evrenci Task<void> c_ShouldNotDiag(const int a, const int b) {
4276219b7c6SDeniz Evrenci if (b == 0)
4286219b7c6SDeniz Evrenci throw Evil{};
4296219b7c6SDeniz Evrenci
4306219b7c6SDeniz Evrenci co_await returnOne();
4316219b7c6SDeniz Evrenci }
4326219b7c6SDeniz Evrenci
c_ShouldDiag(const int a,const int b)4336219b7c6SDeniz Evrenci Task<void> c_ShouldDiag(const int a, const int b) noexcept {
4346219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: an exception may be thrown in function 'c_ShouldDiag' which should not throw exceptions
4356219b7c6SDeniz Evrenci if (b == 0)
4366219b7c6SDeniz Evrenci throw Evil{};
4376219b7c6SDeniz Evrenci
4386219b7c6SDeniz Evrenci co_await returnOne();
4396219b7c6SDeniz Evrenci }
4406219b7c6SDeniz Evrenci
d_ShouldNotDiag(const int a,const int b)4416219b7c6SDeniz Evrenci Task<void, true> d_ShouldNotDiag(const int a, const int b) {
4426219b7c6SDeniz Evrenci co_await returnOne();
4436219b7c6SDeniz Evrenci }
4446219b7c6SDeniz Evrenci
d_ShouldDiag(const int a,const int b)4456219b7c6SDeniz Evrenci Task<void, true> d_ShouldDiag(const int a, const int b) noexcept {
4466219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: an exception may be thrown in function 'd_ShouldDiag' which should not throw exceptions
4476219b7c6SDeniz Evrenci co_await returnOne();
4486219b7c6SDeniz Evrenci }
4496219b7c6SDeniz Evrenci
e_ShouldNotDiag(const int a,const int b)4506219b7c6SDeniz Evrenci Task<void, false, true> e_ShouldNotDiag(const int a, const int b) {
4516219b7c6SDeniz Evrenci co_await returnOne();
4526219b7c6SDeniz Evrenci }
4536219b7c6SDeniz Evrenci
e_ShouldDiag(const int a,const int b)4546219b7c6SDeniz Evrenci Task<void, false, true> e_ShouldDiag(const int a, const int b) noexcept {
4556219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: an exception may be thrown in function 'e_ShouldDiag' which should not throw exceptions
4566219b7c6SDeniz Evrenci co_await returnOne();
4576219b7c6SDeniz Evrenci }
4586219b7c6SDeniz Evrenci
f_ShouldNotDiag(const int a,const int b)4596219b7c6SDeniz Evrenci Task<void, false, false, true> f_ShouldNotDiag(const int a, const int b) {
4606219b7c6SDeniz Evrenci co_await returnOne();
4616219b7c6SDeniz Evrenci }
4626219b7c6SDeniz Evrenci
f_ShouldDiag(const int a,const int b)4636219b7c6SDeniz Evrenci Task<void, false, false, true> f_ShouldDiag(const int a, const int b) noexcept {
4646219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: an exception may be thrown in function 'f_ShouldDiag' which should not throw exceptions
4656219b7c6SDeniz Evrenci co_await returnOne();
4666219b7c6SDeniz Evrenci }
4676219b7c6SDeniz Evrenci
g_ShouldNotDiag(const int a,const int b)4686219b7c6SDeniz Evrenci Task<void, false, false, false, true> g_ShouldNotDiag(const int a,
4696219b7c6SDeniz Evrenci const int b) {
4706219b7c6SDeniz Evrenci co_await returnOne();
4716219b7c6SDeniz Evrenci }
4726219b7c6SDeniz Evrenci
g_ShouldDiag(const int a,const int b)4736219b7c6SDeniz Evrenci Task<void, false, false, false, true> g_ShouldDiag(const int a,
4746219b7c6SDeniz Evrenci const int b) noexcept {
4756219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:39: warning: an exception may be thrown in function 'g_ShouldDiag' which should not throw exceptions
4766219b7c6SDeniz Evrenci co_await returnOne();
4776219b7c6SDeniz Evrenci }
4786219b7c6SDeniz Evrenci
h_ShouldNotDiag(const int a,const int b)4796219b7c6SDeniz Evrenci Task<void, false, false, false, false, true> h_ShouldNotDiag(const int a,
4806219b7c6SDeniz Evrenci const int b) {
4816219b7c6SDeniz Evrenci co_await returnOne();
4826219b7c6SDeniz Evrenci }
4836219b7c6SDeniz Evrenci
4846219b7c6SDeniz Evrenci Task<void, false, false, false, false, true>
h_ShouldDiag(const int a,const int b)4856219b7c6SDeniz Evrenci h_ShouldDiag(const int a, const int b) noexcept {
4866219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: an exception may be thrown in function 'h_ShouldDiag' which should not throw exceptions
4876219b7c6SDeniz Evrenci co_await returnOne();
4886219b7c6SDeniz Evrenci }
4896219b7c6SDeniz Evrenci
490*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
i_ShouldNotDiag(const int a,const int b)491*daac014fSDeniz Evrenci i_ShouldNotDiag(const int a, const int b) {
492*daac014fSDeniz Evrenci co_await returnOne();
493*daac014fSDeniz Evrenci }
494*daac014fSDeniz Evrenci
495*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
i_ShouldNotDiagNoexcept(const int a,const int b)496*daac014fSDeniz Evrenci i_ShouldNotDiagNoexcept(const int a, const int b) noexcept {
497*daac014fSDeniz Evrenci co_await returnOne();
498*daac014fSDeniz Evrenci }
499*daac014fSDeniz Evrenci
500*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
j_ShouldNotDiag(const int a,const int b)501*daac014fSDeniz Evrenci j_ShouldNotDiag(const int a, const int b) {
502*daac014fSDeniz Evrenci co_await returnOne();
503*daac014fSDeniz Evrenci if (b == 0)
504*daac014fSDeniz Evrenci throw b;
505*daac014fSDeniz Evrenci }
506*daac014fSDeniz Evrenci
507*daac014fSDeniz Evrenci Task<int, false, false, false, false, false, true>
j_ShouldDiag(const int a,const int b)508*daac014fSDeniz Evrenci j_ShouldDiag(const int a, const int b) noexcept {
509*daac014fSDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: an exception may be thrown in function 'j_ShouldDiag' which should not throw exceptions
510*daac014fSDeniz Evrenci co_await returnOne();
511*daac014fSDeniz Evrenci if (b == 0)
512*daac014fSDeniz Evrenci throw b;
513*daac014fSDeniz Evrenci }
514*daac014fSDeniz Evrenci
5156219b7c6SDeniz Evrenci } // namespace coawait
5166219b7c6SDeniz Evrenci
5176219b7c6SDeniz Evrenci } // namespace function
5186219b7c6SDeniz Evrenci
5196219b7c6SDeniz Evrenci namespace lambda {
5206219b7c6SDeniz Evrenci
5216219b7c6SDeniz Evrenci namespace coreturn {
5226219b7c6SDeniz Evrenci
__anonafba36150102(const int a, const int b) 5236219b7c6SDeniz Evrenci const auto a_ShouldNotDiag = [](const int a, const int b) -> Task<int> {
5246219b7c6SDeniz Evrenci if (b == 0)
5256219b7c6SDeniz Evrenci throw b;
5266219b7c6SDeniz Evrenci
5276219b7c6SDeniz Evrenci co_return a / b;
5286219b7c6SDeniz Evrenci };
5296219b7c6SDeniz Evrenci
5306219b7c6SDeniz Evrenci const auto b_ShouldNotDiag = [](const int a,
__anonafba36150202(const int a, const int b) 5316219b7c6SDeniz Evrenci const int b) noexcept -> Task<int> {
5326219b7c6SDeniz Evrenci if (b == 0)
5336219b7c6SDeniz Evrenci throw b;
5346219b7c6SDeniz Evrenci
5356219b7c6SDeniz Evrenci co_return a / b;
5366219b7c6SDeniz Evrenci };
5376219b7c6SDeniz Evrenci
__anonafba36150302(const int a, const int b) 5386219b7c6SDeniz Evrenci const auto c_ShouldNotDiag = [](const int a, const int b) -> Task<int> {
5396219b7c6SDeniz Evrenci if (b == 0)
5406219b7c6SDeniz Evrenci throw Evil{};
5416219b7c6SDeniz Evrenci
5426219b7c6SDeniz Evrenci co_return a / b;
5436219b7c6SDeniz Evrenci };
5446219b7c6SDeniz Evrenci
__anonafba36150402(const int a, const int b) 5456219b7c6SDeniz Evrenci const auto c_ShouldDiag = [](const int a, const int b) noexcept -> Task<int> {
5466219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
5476219b7c6SDeniz Evrenci if (b == 0)
5486219b7c6SDeniz Evrenci throw Evil{};
5496219b7c6SDeniz Evrenci
5506219b7c6SDeniz Evrenci co_return a / b;
5516219b7c6SDeniz Evrenci };
5526219b7c6SDeniz Evrenci
__anonafba36150502(const int a, const int b) 5536219b7c6SDeniz Evrenci const auto d_ShouldNotDiag = [](const int a, const int b) -> Task<int, true> {
5546219b7c6SDeniz Evrenci co_return a / b;
5556219b7c6SDeniz Evrenci };
5566219b7c6SDeniz Evrenci
5576219b7c6SDeniz Evrenci const auto d_ShouldDiag = [](const int a,
__anonafba36150602(const int a, const int b) 5586219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, true> {
5596219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
5606219b7c6SDeniz Evrenci co_return a / b;
5616219b7c6SDeniz Evrenci };
5626219b7c6SDeniz Evrenci
5636219b7c6SDeniz Evrenci const auto e_ShouldNotDiag = [](const int a,
__anonafba36150702(const int a, const int b) 5646219b7c6SDeniz Evrenci const int b) -> Task<int, false, true> {
5656219b7c6SDeniz Evrenci co_return a / b;
5666219b7c6SDeniz Evrenci };
5676219b7c6SDeniz Evrenci
5686219b7c6SDeniz Evrenci const auto e_ShouldDiag = [](const int a,
__anonafba36150802(const int a, const int b) 5696219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, false, true> {
5706219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
5716219b7c6SDeniz Evrenci co_return a / b;
5726219b7c6SDeniz Evrenci };
5736219b7c6SDeniz Evrenci
5746219b7c6SDeniz Evrenci const auto f_ShouldNotDiag = [](const int a,
__anonafba36150902(const int a, const int b) 5756219b7c6SDeniz Evrenci const int b) -> Task<int, false, false, true> {
5766219b7c6SDeniz Evrenci co_return a / b;
5776219b7c6SDeniz Evrenci };
5786219b7c6SDeniz Evrenci
5796219b7c6SDeniz Evrenci const auto f_ShouldDiag =
__anonafba36150a02(const int a, const int b) 5806219b7c6SDeniz Evrenci [](const int a, const int b) noexcept -> Task<int, false, false, true> {
5816219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
5826219b7c6SDeniz Evrenci co_return a / b;
5836219b7c6SDeniz Evrenci };
5846219b7c6SDeniz Evrenci
5856219b7c6SDeniz Evrenci const auto g_ShouldNotDiag =
__anonafba36150b02(const int a, const int b) 5866219b7c6SDeniz Evrenci [](const int a, const int b) -> Task<int, false, false, false, true> {
5876219b7c6SDeniz Evrenci co_return a / b;
5886219b7c6SDeniz Evrenci };
5896219b7c6SDeniz Evrenci
5906219b7c6SDeniz Evrenci const auto g_ShouldDiag =
5916219b7c6SDeniz Evrenci [](const int a,
__anonafba36150c02(const int a, const int b) 5926219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, true> {
5936219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
5946219b7c6SDeniz Evrenci co_return a / b;
5956219b7c6SDeniz Evrenci };
5966219b7c6SDeniz Evrenci
5976219b7c6SDeniz Evrenci const auto h_ShouldNotDiag =
5986219b7c6SDeniz Evrenci [](const int a,
__anonafba36150d02(const int a, const int b) 5996219b7c6SDeniz Evrenci const int b) -> Task<int, false, false, false, false, true> {
6006219b7c6SDeniz Evrenci co_return a / b;
6016219b7c6SDeniz Evrenci };
6026219b7c6SDeniz Evrenci
6036219b7c6SDeniz Evrenci const auto h_ShouldDiag =
6046219b7c6SDeniz Evrenci [](const int a,
__anonafba36150e02(const int a, const int b) 6056219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, true> {
6066219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
6076219b7c6SDeniz Evrenci co_return a / b;
6086219b7c6SDeniz Evrenci };
6096219b7c6SDeniz Evrenci
610*daac014fSDeniz Evrenci const auto i_ShouldNotDiag =
611*daac014fSDeniz Evrenci [](const int a,
__anonafba36150f02(const int a, const int b) 612*daac014fSDeniz Evrenci const int b) -> Task<int, false, false, false, false, false, true> {
613*daac014fSDeniz Evrenci co_return a / b;
614*daac014fSDeniz Evrenci };
615*daac014fSDeniz Evrenci
616*daac014fSDeniz Evrenci const auto i_ShouldNotDiagNoexcept =
617*daac014fSDeniz Evrenci [](const int a,
__anonafba36151002(const int a, const int b) 618*daac014fSDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, false, true> {
619*daac014fSDeniz Evrenci co_return a / b;
620*daac014fSDeniz Evrenci };
621*daac014fSDeniz Evrenci
622*daac014fSDeniz Evrenci const auto j_ShouldNotDiag =
623*daac014fSDeniz Evrenci [](const int a,
__anonafba36151102(const int a, const int b) 624*daac014fSDeniz Evrenci const int b) -> Task<int, false, false, false, false, false, true> {
625*daac014fSDeniz Evrenci if (b == 0)
626*daac014fSDeniz Evrenci throw b;
627*daac014fSDeniz Evrenci
628*daac014fSDeniz Evrenci co_return a / b;
629*daac014fSDeniz Evrenci };
630*daac014fSDeniz Evrenci
631*daac014fSDeniz Evrenci const auto j_ShouldDiag =
632*daac014fSDeniz Evrenci [](const int a,
__anonafba36151202(const int a, const int b) 633*daac014fSDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, false, true> {
634*daac014fSDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
635*daac014fSDeniz Evrenci if (b == 0)
636*daac014fSDeniz Evrenci throw b;
637*daac014fSDeniz Evrenci
638*daac014fSDeniz Evrenci co_return a / b;
639*daac014fSDeniz Evrenci };
640*daac014fSDeniz Evrenci
6416219b7c6SDeniz Evrenci } // namespace coreturn
6426219b7c6SDeniz Evrenci
6436219b7c6SDeniz Evrenci namespace coyield {
6446219b7c6SDeniz Evrenci
__anonafba36151302(const int a, const int b) 6456219b7c6SDeniz Evrenci const auto a_ShouldNotDiag = [](const int a, const int b) -> Task<int> {
6466219b7c6SDeniz Evrenci if (b == 0)
6476219b7c6SDeniz Evrenci throw b;
6486219b7c6SDeniz Evrenci
6496219b7c6SDeniz Evrenci co_yield a / b;
6506219b7c6SDeniz Evrenci };
6516219b7c6SDeniz Evrenci
6526219b7c6SDeniz Evrenci const auto b_ShouldNotDiag = [](const int a,
__anonafba36151402(const int a, const int b) 6536219b7c6SDeniz Evrenci const int b) noexcept -> Task<int> {
6546219b7c6SDeniz Evrenci if (b == 0)
6556219b7c6SDeniz Evrenci throw b;
6566219b7c6SDeniz Evrenci
6576219b7c6SDeniz Evrenci co_yield a / b;
6586219b7c6SDeniz Evrenci };
6596219b7c6SDeniz Evrenci
__anonafba36151502(const int a, const int b) 6606219b7c6SDeniz Evrenci const auto c_ShouldNotDiag = [](const int a, const int b) -> Task<int> {
6616219b7c6SDeniz Evrenci if (b == 0)
6626219b7c6SDeniz Evrenci throw Evil{};
6636219b7c6SDeniz Evrenci
6646219b7c6SDeniz Evrenci co_yield a / b;
6656219b7c6SDeniz Evrenci };
6666219b7c6SDeniz Evrenci
__anonafba36151602(const int a, const int b) 6676219b7c6SDeniz Evrenci const auto c_ShouldDiag = [](const int a, const int b) noexcept -> Task<int> {
6686219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
6696219b7c6SDeniz Evrenci if (b == 0)
6706219b7c6SDeniz Evrenci throw Evil{};
6716219b7c6SDeniz Evrenci
6726219b7c6SDeniz Evrenci co_yield a / b;
6736219b7c6SDeniz Evrenci };
6746219b7c6SDeniz Evrenci
__anonafba36151702(const int a, const int b) 6756219b7c6SDeniz Evrenci const auto d_ShouldNotDiag = [](const int a, const int b) -> Task<int, true> {
6766219b7c6SDeniz Evrenci co_yield a / b;
6776219b7c6SDeniz Evrenci };
6786219b7c6SDeniz Evrenci
6796219b7c6SDeniz Evrenci const auto d_ShouldDiag = [](const int a,
__anonafba36151802(const int a, const int b) 6806219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, true> {
6816219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
6826219b7c6SDeniz Evrenci co_yield a / b;
6836219b7c6SDeniz Evrenci };
6846219b7c6SDeniz Evrenci
6856219b7c6SDeniz Evrenci const auto e_ShouldNotDiag = [](const int a,
__anonafba36151902(const int a, const int b) 6866219b7c6SDeniz Evrenci const int b) -> Task<int, false, true> {
6876219b7c6SDeniz Evrenci co_yield a / b;
6886219b7c6SDeniz Evrenci };
6896219b7c6SDeniz Evrenci
6906219b7c6SDeniz Evrenci const auto e_ShouldDiag = [](const int a,
__anonafba36151a02(const int a, const int b) 6916219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, false, true> {
6926219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
6936219b7c6SDeniz Evrenci co_yield a / b;
6946219b7c6SDeniz Evrenci };
6956219b7c6SDeniz Evrenci
6966219b7c6SDeniz Evrenci const auto f_ShouldNotDiag = [](const int a,
__anonafba36151b02(const int a, const int b) 6976219b7c6SDeniz Evrenci const int b) -> Task<int, false, false, true> {
6986219b7c6SDeniz Evrenci co_yield a / b;
6996219b7c6SDeniz Evrenci };
7006219b7c6SDeniz Evrenci
7016219b7c6SDeniz Evrenci const auto f_ShouldDiag =
__anonafba36151c02(const int a, const int b) 7026219b7c6SDeniz Evrenci [](const int a, const int b) noexcept -> Task<int, false, false, true> {
7036219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
7046219b7c6SDeniz Evrenci co_yield a / b;
7056219b7c6SDeniz Evrenci };
7066219b7c6SDeniz Evrenci
7076219b7c6SDeniz Evrenci const auto g_ShouldNotDiag =
__anonafba36151d02(const int a, const int b) 7086219b7c6SDeniz Evrenci [](const int a, const int b) -> Task<int, false, false, false, true> {
7096219b7c6SDeniz Evrenci co_yield a / b;
7106219b7c6SDeniz Evrenci };
7116219b7c6SDeniz Evrenci
7126219b7c6SDeniz Evrenci const auto g_ShouldDiag =
7136219b7c6SDeniz Evrenci [](const int a,
__anonafba36151e02(const int a, const int b) 7146219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, true> {
7156219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
7166219b7c6SDeniz Evrenci co_yield a / b;
7176219b7c6SDeniz Evrenci };
7186219b7c6SDeniz Evrenci
7196219b7c6SDeniz Evrenci const auto h_ShouldNotDiag =
7206219b7c6SDeniz Evrenci [](const int a,
__anonafba36151f02(const int a, const int b) 7216219b7c6SDeniz Evrenci const int b) -> Task<int, false, false, false, false, true> {
7226219b7c6SDeniz Evrenci co_yield a / b;
7236219b7c6SDeniz Evrenci };
7246219b7c6SDeniz Evrenci
7256219b7c6SDeniz Evrenci const auto h_ShouldDiag =
7266219b7c6SDeniz Evrenci [](const int a,
__anonafba36152002(const int a, const int b) 7276219b7c6SDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, true> {
7286219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
7296219b7c6SDeniz Evrenci co_yield a / b;
7306219b7c6SDeniz Evrenci };
7316219b7c6SDeniz Evrenci
732*daac014fSDeniz Evrenci const auto i_ShouldNotDiag =
733*daac014fSDeniz Evrenci [](const int a,
__anonafba36152102(const int a, const int b) 734*daac014fSDeniz Evrenci const int b) -> Task<int, false, false, false, false, false, true> {
735*daac014fSDeniz Evrenci co_yield a / b;
736*daac014fSDeniz Evrenci };
737*daac014fSDeniz Evrenci
738*daac014fSDeniz Evrenci const auto i_ShouldNotDiagNoexcept =
739*daac014fSDeniz Evrenci [](const int a,
__anonafba36152202(const int a, const int b) 740*daac014fSDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, false, true> {
741*daac014fSDeniz Evrenci co_yield a / b;
742*daac014fSDeniz Evrenci };
743*daac014fSDeniz Evrenci
744*daac014fSDeniz Evrenci const auto j_ShouldNotDiag =
745*daac014fSDeniz Evrenci [](const int a,
__anonafba36152302(const int a, const int b) 746*daac014fSDeniz Evrenci const int b) -> Task<int, false, false, false, false, false, true> {
747*daac014fSDeniz Evrenci if (b == 0)
748*daac014fSDeniz Evrenci throw b;
749*daac014fSDeniz Evrenci
750*daac014fSDeniz Evrenci co_yield a / b;
751*daac014fSDeniz Evrenci };
752*daac014fSDeniz Evrenci
753*daac014fSDeniz Evrenci const auto j_ShouldDiag =
754*daac014fSDeniz Evrenci [](const int a,
__anonafba36152402(const int a, const int b) 755*daac014fSDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, false, true> {
756*daac014fSDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
757*daac014fSDeniz Evrenci if (b == 0)
758*daac014fSDeniz Evrenci throw b;
759*daac014fSDeniz Evrenci
760*daac014fSDeniz Evrenci co_yield a / b;
761*daac014fSDeniz Evrenci };
762*daac014fSDeniz Evrenci
7636219b7c6SDeniz Evrenci } // namespace coyield
7646219b7c6SDeniz Evrenci
7656219b7c6SDeniz Evrenci namespace coawait {
7666219b7c6SDeniz Evrenci
__anonafba36152502(const int a, const int b) 7676219b7c6SDeniz Evrenci const auto a_ShouldNotDiag = [](const int a, const int b) -> Task<void> {
7686219b7c6SDeniz Evrenci if (b == 0)
7696219b7c6SDeniz Evrenci throw b;
7706219b7c6SDeniz Evrenci
7716219b7c6SDeniz Evrenci co_await returnOne();
7726219b7c6SDeniz Evrenci };
7736219b7c6SDeniz Evrenci
7746219b7c6SDeniz Evrenci const auto b_ShouldNotDiag = [](const int a,
__anonafba36152602(const int a, const int b) 7756219b7c6SDeniz Evrenci const int b) noexcept -> Task<void> {
7766219b7c6SDeniz Evrenci if (b == 0)
7776219b7c6SDeniz Evrenci throw b;
7786219b7c6SDeniz Evrenci
7796219b7c6SDeniz Evrenci co_await returnOne();
7806219b7c6SDeniz Evrenci };
7816219b7c6SDeniz Evrenci
__anonafba36152702(const int a, const int b) 7826219b7c6SDeniz Evrenci const auto c_ShouldNotDiag = [](const int a, const int b) -> Task<void> {
7836219b7c6SDeniz Evrenci if (b == 0)
7846219b7c6SDeniz Evrenci throw Evil{};
7856219b7c6SDeniz Evrenci
7866219b7c6SDeniz Evrenci co_await returnOne();
7876219b7c6SDeniz Evrenci };
7886219b7c6SDeniz Evrenci
__anonafba36152802(const int a, const int b) 7896219b7c6SDeniz Evrenci const auto c_ShouldDiag = [](const int a, const int b) noexcept -> Task<void> {
7906219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
7916219b7c6SDeniz Evrenci if (b == 0)
7926219b7c6SDeniz Evrenci throw Evil{};
7936219b7c6SDeniz Evrenci
7946219b7c6SDeniz Evrenci co_await returnOne();
7956219b7c6SDeniz Evrenci };
7966219b7c6SDeniz Evrenci
__anonafba36152902(const int a, const int b) 7976219b7c6SDeniz Evrenci const auto d_ShouldNotDiag = [](const int a, const int b) -> Task<void, true> {
7986219b7c6SDeniz Evrenci co_await returnOne();
7996219b7c6SDeniz Evrenci };
8006219b7c6SDeniz Evrenci
8016219b7c6SDeniz Evrenci const auto d_ShouldDiag = [](const int a,
__anonafba36152a02(const int a, const int b) 8026219b7c6SDeniz Evrenci const int b) noexcept -> Task<void, true> {
8036219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
8046219b7c6SDeniz Evrenci co_await returnOne();
8056219b7c6SDeniz Evrenci };
8066219b7c6SDeniz Evrenci
8076219b7c6SDeniz Evrenci const auto e_ShouldNotDiag = [](const int a,
__anonafba36152b02(const int a, const int b) 8086219b7c6SDeniz Evrenci const int b) -> Task<void, false, true> {
8096219b7c6SDeniz Evrenci co_await returnOne();
8106219b7c6SDeniz Evrenci };
8116219b7c6SDeniz Evrenci
8126219b7c6SDeniz Evrenci const auto e_ShouldDiag = [](const int a,
__anonafba36152c02(const int a, const int b) 8136219b7c6SDeniz Evrenci const int b) noexcept -> Task<void, false, true> {
8146219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:27: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
8156219b7c6SDeniz Evrenci co_await returnOne();
8166219b7c6SDeniz Evrenci };
8176219b7c6SDeniz Evrenci
8186219b7c6SDeniz Evrenci const auto f_ShouldNotDiag = [](const int a,
__anonafba36152d02(const int a, const int b) 8196219b7c6SDeniz Evrenci const int b) -> Task<void, false, false, true> {
8206219b7c6SDeniz Evrenci co_await returnOne();
8216219b7c6SDeniz Evrenci };
8226219b7c6SDeniz Evrenci
8236219b7c6SDeniz Evrenci const auto f_ShouldDiag =
__anonafba36152e02(const int a, const int b) 8246219b7c6SDeniz Evrenci [](const int a, const int b) noexcept -> Task<void, false, false, true> {
8256219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
8266219b7c6SDeniz Evrenci co_await returnOne();
8276219b7c6SDeniz Evrenci };
8286219b7c6SDeniz Evrenci
8296219b7c6SDeniz Evrenci const auto g_ShouldNotDiag =
__anonafba36152f02(const int a, const int b) 8306219b7c6SDeniz Evrenci [](const int a, const int b) -> Task<void, false, false, false, true> {
8316219b7c6SDeniz Evrenci co_await returnOne();
8326219b7c6SDeniz Evrenci };
8336219b7c6SDeniz Evrenci
8346219b7c6SDeniz Evrenci const auto g_ShouldDiag =
8356219b7c6SDeniz Evrenci [](const int a,
__anonafba36153002(const int a, const int b) 8366219b7c6SDeniz Evrenci const int b) noexcept -> Task<void, false, false, false, true> {
8376219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
8386219b7c6SDeniz Evrenci co_await returnOne();
8396219b7c6SDeniz Evrenci };
8406219b7c6SDeniz Evrenci
8416219b7c6SDeniz Evrenci const auto h_ShouldNotDiag =
8426219b7c6SDeniz Evrenci [](const int a,
__anonafba36153102(const int a, const int b) 8436219b7c6SDeniz Evrenci const int b) -> Task<void, false, false, false, false, true> {
8446219b7c6SDeniz Evrenci co_await returnOne();
8456219b7c6SDeniz Evrenci };
8466219b7c6SDeniz Evrenci
8476219b7c6SDeniz Evrenci const auto h_ShouldDiag =
8486219b7c6SDeniz Evrenci [](const int a,
__anonafba36153202(const int a, const int b) 8496219b7c6SDeniz Evrenci const int b) noexcept -> Task<void, false, false, false, false, true> {
8506219b7c6SDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
8516219b7c6SDeniz Evrenci co_await returnOne();
8526219b7c6SDeniz Evrenci };
8536219b7c6SDeniz Evrenci
854*daac014fSDeniz Evrenci const auto i_ShouldNotDiag =
855*daac014fSDeniz Evrenci [](const int a,
__anonafba36153302(const int a, const int b) 856*daac014fSDeniz Evrenci const int b) -> Task<int, false, false, false, false, false, true> {
857*daac014fSDeniz Evrenci co_await returnOne();
858*daac014fSDeniz Evrenci };
859*daac014fSDeniz Evrenci
860*daac014fSDeniz Evrenci const auto i_ShouldNotDiagNoexcept =
861*daac014fSDeniz Evrenci [](const int a,
__anonafba36153402(const int a, const int b) 862*daac014fSDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, false, true> {
863*daac014fSDeniz Evrenci co_await returnOne();
864*daac014fSDeniz Evrenci };
865*daac014fSDeniz Evrenci
866*daac014fSDeniz Evrenci const auto j_ShouldNotDiag =
867*daac014fSDeniz Evrenci [](const int a,
__anonafba36153502(const int a, const int b) 868*daac014fSDeniz Evrenci const int b) -> Task<int, false, false, false, false, false, true> {
869*daac014fSDeniz Evrenci co_await returnOne();
870*daac014fSDeniz Evrenci if (b == 0)
871*daac014fSDeniz Evrenci throw b;
872*daac014fSDeniz Evrenci };
873*daac014fSDeniz Evrenci
874*daac014fSDeniz Evrenci const auto j_ShouldDiag =
875*daac014fSDeniz Evrenci [](const int a,
__anonafba36153602(const int a, const int b) 876*daac014fSDeniz Evrenci const int b) noexcept -> Task<int, false, false, false, false, false, true> {
877*daac014fSDeniz Evrenci // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
878*daac014fSDeniz Evrenci co_await returnOne();
879*daac014fSDeniz Evrenci if (b == 0)
880*daac014fSDeniz Evrenci throw b;
881*daac014fSDeniz Evrenci };
882*daac014fSDeniz Evrenci
8836219b7c6SDeniz Evrenci } // namespace coawait
8846219b7c6SDeniz Evrenci
8856219b7c6SDeniz Evrenci } // namespace lambda
886