Files
clang-p2996/clang/test/SemaCXX/PR76631.cpp
Qizhi Hu 2fe5b15718 [Clang][Sema] improve sema check of clang::musttail attribute (#77727)
Call function with no-return attribute generates code with unreachable
instruction instead of return and if the call statement has
`clang::musttail` attribute, it would crash in `VerifyPass`. Check this
condition in Sema ahead.
Fix [issue](https://github.com/llvm/llvm-project/issues/76631)

Co-authored-by: huqizhi <836744285@qq.com>
2024-01-17 20:59:01 +08:00

10 lines
337 B
C++

// RUN: %clang_cc1 -verify -std=c++11 -fsyntax-only %s
[[noreturn]] void throw_int() {
throw int(); // expected-error {{cannot use 'throw' with exceptions disabled}}
}
void throw_int_wrapper() {
[[clang::musttail]] return throw_int(); // expected-error {{'musttail' attribute may not be used with no-return-attribute functions}}
}