Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6504,6 +6504,11 @@ ExpectedDecl ASTNodeImporter::VisitVarTemplateSpecializationDecl(
return D2;
}

// Update InsertPos, because preceding import calls may have invalidated
// it by adding new specializations.
if (!VarTemplate->findSpecialization(TemplateArgs, InsertPos))
VarTemplate->AddSpecialization(D2, InsertPos);

QualType T;
if (Error Err = importInto(T, D->getType()))
return std::move(Err);
Expand Down Expand Up @@ -6540,8 +6545,6 @@ ExpectedDecl ASTNodeImporter::VisitVarTemplateSpecializationDecl(
if (FoundSpecialization)
D2->setPreviousDecl(FoundSpecialization->getMostRecentDecl());

VarTemplate->AddSpecialization(D2, InsertPos);

addDeclToContexts(D, D2);

// Import the rest of the chain. I.e. import all subsequent declarations.
Expand Down