[clang-cl] Crash in MSVC ABI mangler when mangling template function with [[clang::annotate_type]] and deduced return type
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Clang crashes (segfault) in the MSVC ABI mangler when mangling a template function that has [[clang::annotate_type(...)]] on a deduced return type (auto / decltype(auto)).
Minimal reproducer (clang-cl --target=aarch64-pc-windows-msvc -std:c++latest -c repro.cpp):
```c++
template
constexpr auto [[clang::annotate_type("foo")]] func(const char(&p)[N])
{
return N;
}
void caller() {
func("hello");
}
```
Clang version 21.1.8. This code compiles on Clang 20.
Contributor guide
Research direction
Start by reproducing the crash with clang-cl --target=aarch64-pc-windows-msvc -std:c++latest -c repro.cpp using the minimal template in the issue, then trace the failure in the MSVC ABI mangler. Done means this reproducer compiles without a crash and the behavior is covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100