https://bugs.llvm.org/show_bug.cgi?id=49453
Bug ID: 49453
Summary: throw expression in noexcept coroutine erroneously
triggers -Wexception
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
The entire body of a coroutine is implicitly wrapped in a try/catch, and
exceptions are (usually) marshaled as exception_ptrs into the promise to be
rethrown when the coroutine type is awaited in another coroutine.
So, what looks like an unhandled `throw` in a `noexcept` function is in fact
not in the case of coroutines.
For example:
unifex::task<int> bar() noexcept {
throw 42;
co_return 42;
}
warning: 'bar' has a non-throwing exception specification but can still throw
[-Wexceptions]
throw 42;
^
<source>:18:11: note: function declared non-throwing here
task<int> bar() noexcept {
^ ~~~~~~~~
1 warning generated.
See https://godbolt.org/z/Pj7qPW
I suggest that `-Wexception` be suppressed for all coroutines.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs