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

Manuel Klimek klimek at google.com
Thu Jun 25 19:11:42 PDT 2015


That works! \o/

On Thu, Jun 25, 2015 at 2:02 PM Richard Smith <richard at metafoo.co.uk> wrote:

> ================
> 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/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150626/43875804/attachment.html>


More information about the cfe-commits mailing list