Assertion with mismatched dependent local extern declarations
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This diagnoses the mismatch correctly, but triggers an assertion
```
Assertion failed: (isa(D) && "declaration not instantiated in this scope"), function findInstantiationOf, file SemaTemplateInstantiate.cpp, line 4792.
```
```cpp
int foo9_decl;
template void foo9() {
if constexpr (x) {
extern int foo9_decl;
} else {
extern thread_local int foo9_decl;
}
}
void test_foo9() {
foo9();
foo9();
}
```
Contributor guide
Research direction
Start by reproducing the assertion with the provided C++ template example, then inspect SemaTemplateInstantiate.cpp around findInstantiationOf at line 4792. Trace why the mismatched dependent local extern declarations reach the assertion. Done means the example diagnoses the mismatch without asserting, with a regression test covering the case.
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
- 52/100