[cfe-commits] [clang] bugfix for #10896: Assertion failure @ lib/AST/ASTContext.cpp:1056

Douglas Gregor dgregor at apple.com
Mon Sep 19 14:30:49 PDT 2011



Sent from my iPhone

On Sep 19, 2011, at 9:58 AM, Matthieu Monrocq <matthieu.monrocq at gmail.com> wrote:

> 
> 
> 2011/9/19 Douglas Gregor <dgregor at apple.com>
> Hello Stepan,
> 
> On Sep 15, 2011, at 1:28 PM, Stepan Dyatkovskiy wrote:
> 
> > C++ does not allow member templates. Clang doesn't check for this case and crash.
> >
> > Please find attach the patch which fixes this.
> 
> +    // FIXME: Check that the name is an identifier!
> +    IdentifierInfo *II = Name.getAsIdentifierInfo();
> +
> +    // Match up the template parameter lists with the scope specifier, then
> +    // determine whether we have a template or a template specialization.
> +    bool isExplicitSpecialization = false;
> +    bool Invalid = false;
> +    if (TemplateParameterList *TemplateParams =
> +          MatchTemplateParametersToScopeSpecifier(
> +                                D.getDeclSpec().getSourceRange().getBegin(),
> +                                D.getIdentifierLoc(),
> +                                D.getCXXScopeSpec(),
> +                                TemplateParameterLists.get(),
> +                                TemplateParameterLists.size(),
> +                                /*never a friend*/false,
> +                                isExplicitSpecialization,
> +                                Invalid)) {
> 
> Why are we even trying to match up the template parameter lists here? One isn't allowed to write a specialization inside a class, much less a specialization that looks like a variable. Couldn't this be a simpler "is there a template parameter list" check?
> 
>        - Doug
>  
> Does not MSVC allow member function templates to be specialized within the class directly ?

It does, and we handle that. This path is for data members. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110919/4f9d23fa/attachment.html>


More information about the cfe-commits mailing list