[PATCH] Fix crash-on-invalid bug in template instantiation.

Richard Smith richard at metafoo.co.uk
Thu Jun 25 13:13:44 PDT 2015


================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:1930-1939
@@ -1929,12 +1929,12 @@
 
   // \brief Record the point of instantiation.
   if (MemberSpecializationInfo *MSInfo 
         = Instantiation->getMemberSpecializationInfo()) {
     MSInfo->setTemplateSpecializationKind(TSK);
     MSInfo->setPointOfInstantiation(PointOfInstantiation);
   } else if (ClassTemplateSpecializationDecl *Spec 
         = dyn_cast<ClassTemplateSpecializationDecl>(Instantiation)) {
     Spec->setTemplateSpecializationKind(TSK);
     Spec->setPointOfInstantiation(PointOfInstantiation);
   }
 
----------------
Is it sufficient to move this block of code to after the bail-out below? It seems like the problem may be that we've done some amount of the instantiation work (storing the TSK on the specialization) before we bail out, and so the AST is left in an inconsistent state.

http://reviews.llvm.org/D10622

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list