Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22104

co_await inside catch no longer compiling with GCC12 [duplicate]

$
0
0

I have a code that looks like this:

auto func() -> asio::awaitable<void> {    try {        co_await async_operation();    } catch(boost::system::system_error const& e) {        co_return co_await another_async_operation();    }}

This code worked perfectly with GCC 11, but with GCC 12 it won't compile:

file.cpp:3:19: error: await expressions are not permitted in handlers  3 |         co_return co_await another_async_operation();    |                   ^~~~~~~~

Why is that and how can I fix it?


Viewing all articles
Browse latest Browse all 22104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>