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
template-specialization-assertion.diff
Description: template-specialization-assertion.diff
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
