Skip to content

Commit

Permalink
[NFC] Correct the test code in pr65018
Browse files Browse the repository at this point in the history
The test code in pr65018 is actually incorrect since the optimizier are
free to optimize the whole coroutine body away. This patch corrected
this.
  • Loading branch information
ChuanqiXu9 committed Aug 29, 2023
1 parent 863c346 commit 6f1b2e4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion clang/test/CodeGenCoroutines/pr65018.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ struct MyTask {
// A lazy promise with an await_transform method that supports awaiting
// integer references using the Awaiter struct above.
struct promise_type {
MyTask get_return_object() { return {}; }
MyTask get_return_object() {
return MyTask{
std::coroutine_handle<promise_type>::from_promise(*this),
};
}

std::suspend_always initial_suspend() { return {}; }
std::suspend_always final_suspend() noexcept { return {}; }
void unhandled_exception();

auto await_transform(const int& x) { return Awaiter{x}; }
};

std::coroutine_handle<> h;
};

// A global array of integers.
Expand Down

0 comments on commit 6f1b2e4

Please sign in to comment.