C++ Logo

std-discussion

Advanced search

Re: coroutine generator example issue

From: Daniel Krügler <daniel.kruegler_at_[hidden]>
Date: Thu, 20 Oct 2022 09:36:16 +0200
Am Do., 20. Okt. 2022 um 09:21 Uhr schrieb dfleury2--- via
Std-Discussion <std-discussion_at_[hidden]>:
>
> Hi,
> I am currently working on coroutine, and how they works.
>
> In the C++ ISO draft (N4860), on at 9.5.4-10, page 209, there is an generator example.
>
> The line : "auto final_suspend() { return std::suspend_always{}; }" causes an issue to gcc 12.2, where it expects a noexcept qualifier for final_suspend.

According to the most recent working draft N4917 we have now this line

auto final_suspend() noexcept { return std::suspend_always{}; }

> At 9.5.4-15, it is said that "The expression co_await promise .final_suspend() shall not be potentially-throwing"
>
> Here I am sure what mean exactly "shall", and if gcc is too conservative, or the example miss the noexcept qualifier.
>
> Regards,
>
> PS: Since I have only access to the draft, may be something has changed in the final document.

It was fixed in the final C++20 document, I just checked it.

- Daniel

Received on 2022-10-20 07:36:28