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

Douglas Gregor dgregor at apple.com
Sat Aug 6 13:11:25 PDT 2011


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.

Everything else looks good, thanks!

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110806/0224ca48/attachment.html>


More information about the cfe-commits mailing list