noexcept functions push an EHTerminateScope onto the cleanup stack. The musttail codegen did not know how to skip this scope, causing a "cannot compile this tail call skipping over cleanups yet" error even when both caller and callee are noexcept. Skip the EHTerminateScope when the callee is nounwind (noexcept). The callee's own noexcept handler prevents any exception from propagating, so the caller's terminate handler is unnecessary. Fixes #53087.
10 lines
388 B
C++
10 lines
388 B
C++
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm %s -triple x86_64-unknown-linux-gnu -o /dev/null -verify
|
|
|
|
// Negative: musttail to a non-noexcept callee from a noexcept function.
|
|
|
|
int ThrowingFunc(int);
|
|
|
|
int TestThrowingCallee(int x) noexcept {
|
|
[[clang::musttail]] return ThrowingFunc(x); // expected-error {{'musttail' in a noexcept function requires a noexcept callee}}
|
|
}
|