Clang crashes when constructor initializer list contains a template parameter type
Open
clang:diagnostics
clang:frontend
crash-on-invalid
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Clang crashes on the following ~~valid~~ invalid C++ code (when assertions are enabled):
```cpp
struct S0 {
S0(int) {}
template
S0(T) : Member(42), T(42) {};
int Member{21};
};
void InstantiateS0() {
S0 S0Instance(67);
}
```
```
Assertion `IdealIndex < NumIdealInits && "initializer not found in initializer list"' failed.
```
The reproducer on Compiler Explorer:
https://godbolt.org/z/xaEWMM5b5
The correct behaviour would be accepting the code, and warning for the wrong initialization order.
Contributor guide
Assessment
This issue has not been assessed yet.