[cfe-commits] [PATCH] Fix for assertion when solving unresolved templates

Magee, Josh Joshua.Magee at am.sony.com
Mon Aug 27 14:58:43 PDT 2012


At 1346046509 seconds past the Epoch, Rafael Espí­ndola wrote:
> Not exactly my area, but the patch is really simple and turns a crash
> into a fairly reasonable error message, so LGTM!
> 

Thank you for the review!  I don't have a commit access, could you
commit for me please?

Thanks again,
Josh

> On 20 August 2012 17:51, Magee, Josh <Joshua.Magee at am.sony.com> wrote:
> > Hi,
> >
> > This is my first attempt at submitting a patch. :-)
> >
> > The patch fixes an assertion that occurs when rewriting an UnresolvedLookupExpr
> > instance consisting of a call to a templated function with no explicit template
> > arguments.  In the regression test included with this patch, the function "bar"
> > is called without explicit template arguments.  While this is an error, it
> > should generate a diagnostic error message without triggering the assertion.
> >
> > The assertion occurs because it is forbidden to call 'getNumTemplateArgs' and
> > 'getTemplateArgs' on objects without explicit template arguments (as spelled
> > out in a comment in include/clang/AST/ExprCXX.h, right before
> > getExplicitTemplateArgs).  The fix is to guard the call to
> > TransformTemplateArguments so that it is only invoked if there really are
> > explicit template arguments.
> >
> > Another possible solution would be to check for explicit template arguments
> > inside getNumTemplateArgs() and friends, which is actually how
> > corresponding/similar methods are implemented for DeclRefExpr in Expr.h.  Given
> > the comment mentioned above, it seems that this inconsistency is by design.
> > I'd be interested to know the motivation behind the difference in design.
> >
> >
> > Thank you!
> > Josh Magee
> >
> 
> Thanks,
> Rafael
>




More information about the cfe-commits mailing list