[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Wed May 22 07:29:24 PDT 2024


balazske wrote:

I could reproduce this assertion (with CTU analysis on project "contour"):
```
clang-19: llvm-project/clang/lib/AST/DeclTemplate.cpp:370: void clang::RedeclarableTemplateDecl::addSpecializationImpl(llvm::FoldingSetVector<EntryType>&, EntryType*, void*) [with Derived = clang::VarTemplateDecl; EntryType = clang::VarTemplateSpeciali
zationDecl]: Assertion `!findSpecializationImpl(Specializations, CorrectInsertPos, SETraits::getTemplateArgs(Entry)) && InsertPos == CorrectInsertPos && "given incorrect InsertPos for specialization"' failed.
```
With the latest clang (debug or release) the assertion does not show up any more (when the same test is run). Still I think that this change is an improvement in the code and could be merged, even if no test can be found that triggers the assertion.

https://github.com/llvm/llvm-project/pull/89887


More information about the cfe-commits mailing list