[cfe-commits] [PATCH] Allow redeclaring a function in an inner scope with different default arguments
John McCall
rjmccall at apple.com
Mon Mar 12 13:14:57 PDT 2012
On Mar 12, 2012, at 3:41 AM, James Molloy wrote:
> Hi John,
>
> Attached is a slightly modified version of the patch.
>
>> I would prefer to only compute this when there's actually a default
> argument
>> on the old declaration. It should be easy enough to just pass down the
> scope
>> of the new declaration.
>
> I have done this.
>
>> This doesn't seem to be right. We should be ignoring the default argument
>> in other scopes regardless of whether the new declaration has a default
>> argument.
>
> While I originally agreed with you on this, I was at home, didn't have the
> patch available and couldn't see that actually the patch *does* actually do
> the right thing. I have added an extra testcase however as this behaviour is
> not currently tested. See i() in SemaCXX/default1.cpp.
>
>> Also, don't we need to look for previous declarations that *are* in the
> same
>> scope and make sure we use their default arguments?
>
> Again, this wasn't tested but does do the right thing. I've added a testcase
> into CodeGenCXX/default-arguments.cpp based on the snippet you posted.
>
> Is this OK now?
Yeah, looks good. Thanks!
John.
More information about the cfe-commits
mailing list