[cfe-commits] PATCH: Add support for resolving overloaded template functions in Sema::DiagnoseEmptyLookup

Kaelyn Uhrain rikka at google.com
Mon Aug 8 10:13:50 PDT 2011


On Sat, Aug 6, 2011 at 1:11 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> On Aug 4, 2011, at 4:43 PM, Kaelyn Uhrain wrote:
>
> On Thu, Aug 4, 2011 at 4:41 PM, Kaelyn Uhrain <rikka at google.com> wrote:
>
>>
>>
>> On Thu, Aug 4, 2011 at 4:36 PM, Chandler Carruth <chandlerc at google.com>wrote:
>>
>>> On Thu, Aug 4, 2011 at 4:35 PM, Kaelyn Uhrain <rikka at google.com> wrote:
>>>
>>>> I've committed the fix and test cases as r136943, and rebased my patch
>>>> against that revision.
>>>
>>>
>>> Missing attachment? (not a big deal, easy to review the original patch)
>>>
>>
>> Grr....
>>
>
> WTF?! I've attached the patch TWICE now in gmail only to not have it go
> out. :(  Let's try a third time...
>
> Wait... dammit, I screwed up generating the patch and tried attaching a
> 0-byte file. :'(
> <typo-correction-template-overload.diff>
>
>
> @@ -1458,10 +1459,13 @@ bool Sema::DiagnoseEmptyLookup(Scope *S,
> CXXScopeSpec &SS, LookupResult &R,
>                                          CDEnd = Corrected.end();
>               CD != CDEnd; ++CD) {
>            if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*CD))
> -            AddOverloadCandidate(FD, DeclAccessPair::make(*CD, AS_none),
> +            AddOverloadCandidate(FD, DeclAccessPair::make(FD, AS_none),
>                                   Args, NumArgs, OCS);
> -          // TODO: Handle FunctionTemplateDecl and other Decl types that
> -          // support overloading and could be corrected by CorrectTypo.
> +          else if (FunctionTemplateDecl *FTD =
> +                   dyn_cast<FunctionTemplateDecl>(*CD))
> +            AddTemplateOverloadCandidate(
> +                FTD, DeclAccessPair::make(FTD, AS_none),
> ExplicitTemplateArgs,
> +                Args, NumArgs, OCS);
>
> The FunctionTemplateDecl path looks good. Note that, if there are explicit
> template arguments, we should not add FunctionDecls to the overload
> candidate set.
>

Ah, good point. I'll go ahead and check in the one-line change adding " if
(!ExplicitTemplateArgs || ExplicitTemplateArgs->size() == 0)" just before
the call to AddOverloadCandidate so that FunctionDecls aren't added when
there are explicit template arguments.

Thanks,
Kaelyn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110808/a13386e4/attachment.html>


More information about the cfe-commits mailing list