[cfe-commits] [Patch] - Avoid duplicated visits to default arguments for class templates

Richard Smith richard at metafoo.co.uk
Wed May 30 16:57:36 PDT 2012


On Tue, May 29, 2012 at 11:42 PM, Yang Chen <chenyang at cs.utah.edu> wrote:

> **
> Hi Richard,
>
>
> On 5/29/12 6:41 PM, Richard Smith wrote:
>
> Hi,
>
>  On Sun, May 27, 2012 at 6:29 PM, Yang Chen <chenyang at cs.utah.edu> wrote:
>
>> Seems RecursiveASTVisitor has a bug which could cause duplicated visits
>> to default arguments for a class template. For example, given the code
>> below:
>>
>> class X;
>> template<class T = X> class Y;
>> template<class T> class Y {};
>>
>> The default argument 'X' will be visited twice. The attached patch fixed
>> the problem.
>
>
>  Thanks, the patch looks good. We should also handle
> NonTypeTemplateParmDecl in the same way.
>
>
> Fixed.
>
>
>
>
>> I also attached a small testcase. Thanks.
>
>
>  (It's conventional to put the code and test changes in the same patch
> file.) Tests for the other two flavours of template parameters would be
> great (you will probably need to add new ExpectedLocationVisitor subclasses
> to RecursiveASTVisitorTest to test those).
>
>
> Thanks for the info. I attached a new patch which includes two more test
> cases for TemplateTemplateParmDecl and NonTypeTemplateParmDecl.
>

Thanks! Committed as r157723.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120530/15b42c77/attachment.html>


More information about the cfe-commits mailing list