From ce9978ff1f751b30f52d309756015489146b48bc Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 28 Mar 2012 14:34:23 +0000 Subject: When we form a new function/class template specialization, we first search for the specialization (in a folding set) and, if not found form a *Decl that is then inserted into that folding set. In rare cases, the folding set may be reallocated between the search and the insertion, causing a crash. No test case, because triggering rehashing consistently in a small test case is not feasible. Fixes . llvm-svn: 153575 --- clang/lib/AST/Decl.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'clang/lib/AST/Decl.cpp') diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index e476bfb6f1f..399f2e48abe 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2255,22 +2255,7 @@ FunctionDecl::setFunctionTemplateSpecialization(ASTContext &C, TemplateArgsAsWritten, PointOfInstantiation); TemplateOrSpecialization = Info; - - // Insert this function template specialization into the set of known - // function template specializations. - if (InsertPos) - Template->addSpecialization(Info, InsertPos); - else { - // Try to insert the new node. If there is an existing node, leave it, the - // set will contain the canonical decls while - // FunctionTemplateDecl::findSpecialization will return - // the most recent redeclarations. - FunctionTemplateSpecializationInfo *Existing - = Template->getSpecializations().GetOrInsertNode(Info); - (void)Existing; - assert((!Existing || Existing->Function->isCanonicalDecl()) && - "Set is supposed to only contain canonical decls"); - } + Template->addSpecialization(Info, InsertPos); } void -- cgit v1.2.3