[PATCH] Fix crash-on-invalid bug in template instantiation.
Richard Smith
richard at metafoo.co.uk
Thu Jun 25 14:02:18 PDT 2015
================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:2273-2297
@@ -2272,27 +2274,27 @@
// Check whether we have already instantiated or specialized this class
// template specialization.
if (ClassTemplateSpec->getSpecializationKind() != TSK_Undeclared) {
if (ClassTemplateSpec->getSpecializationKind() ==
TSK_ExplicitInstantiationDeclaration &&
TSK == TSK_ExplicitInstantiationDefinition) {
// An explicit instantiation definition follows an explicit instantiation
// declaration (C++0x [temp.explicit]p10); go ahead and perform the
// explicit instantiation.
ClassTemplateSpec->setSpecializationKind(TSK);
// If this is an explicit instantiation definition, mark the
// vtable as used.
if (TSK == TSK_ExplicitInstantiationDefinition &&
!ClassTemplateSpec->isInvalidDecl())
MarkVTableUsed(PointOfInstantiation, ClassTemplateSpec, true);
return false;
}
// We can only instantiate something that hasn't already been
// instantiated or specialized. Fail without any diagnostics: our
// caller will provide an error message.
return true;
}
----------------
Better solution: just delete all of this code.
http://reviews.llvm.org/D10622
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list