[clang] Attribute support `[[clang::musttail]]` in `ExprConstant.cpp` (work in progress) (PR #138477)
Hana Dusíková via cfe-commits
cfe-commits at lists.llvm.org
Sun May 4 14:49:11 PDT 2025
hanickadot wrote:
```c++
constexpr int deep_test(int remaining) {
if (remaining == 0) {
return 42;
}
MUST_TAIL return deep_test(remaining - 1);
}
constexpr int result = deep_test(200'000);
```
With debug build of clang:
```sh
clang++ -std=c++26 -c deep.cpp -fconstexpr-depth=1 -DMUST_TAIL="[[clang::musttail]]"
real 0m7.227s
user 0m7.199s
sys 0m0.019s
```
```sh
clang++ -std=c++26 -c deep.cpp -fconstexpr-depth=200000 -DMUST_TAIL=
Segmentation fault: 11
```
https://github.com/llvm/llvm-project/pull/138477
More information about the cfe-commits
mailing list