[cfe-commits] r84693 - /cfe/trunk/lib/Sema/SemaOverload.cpp

Anders Carlsson andersca at mac.com
Tue Oct 20 15:53:47 PDT 2009


Author: andersca
Date: Tue Oct 20 17:53:47 2009
New Revision: 84693

URL: http://llvm.org/viewvc/llvm-project?rev=84693&view=rev
Log:
Change ResolveAddressOfOverloadedFunction to support TemplateIdRefExpr. No testcase yet because FixOverloadedFunctionReference needs to be updated too. Doug, plz review.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=84693&r1=84692&r2=84693&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Oct 20 17:53:47 2009
@@ -4289,6 +4289,10 @@
       OvlExpr = UnOp->getSubExpr()->IgnoreParens();
   }
 
+  bool HasExplicitTemplateArgs = false;
+  const TemplateArgument *ExplicitTemplateArgs = 0;
+  unsigned NumExplicitTemplateArgs = 0;
+  
   // Try to dig out the overloaded function.
   FunctionTemplateDecl *FunctionTemplate = 0;
   if (DeclRefExpr *DR = dyn_cast<DeclRefExpr>(OvlExpr)) {
@@ -4298,9 +4302,17 @@
     Ovl = dyn_cast<OverloadedFunctionDecl>(ME->getMemberDecl());
     FunctionTemplate = dyn_cast<FunctionTemplateDecl>(ME->getMemberDecl());
     // FIXME: Explicit template arguments
+  } else if (TemplateIdRefExpr *TIRE = dyn_cast<TemplateIdRefExpr>(OvlExpr)) {
+    TemplateName Name = TIRE->getTemplateName();
+    Ovl = Name.getAsOverloadedFunctionDecl();
+    FunctionTemplate = 
+      dyn_cast_or_null<FunctionTemplateDecl>(Name.getAsTemplateDecl());
+    
+    HasExplicitTemplateArgs = true;
+    ExplicitTemplateArgs = TIRE->getTemplateArgs();
+    NumExplicitTemplateArgs = TIRE->getNumTemplateArgs();
   }
-  // FIXME: TemplateIdRefExpr?
-
+  
   // If there's no overloaded function declaration or function template,
   // we're done.
   if (!Ovl && !FunctionTemplate)
@@ -4345,8 +4357,9 @@
       FunctionDecl *Specialization = 0;
       TemplateDeductionInfo Info(Context);
       if (TemplateDeductionResult Result
-            = DeduceTemplateArguments(FunctionTemplate, /*FIXME*/false,
-                                      /*FIXME:*/0, /*FIXME:*/0,
+            = DeduceTemplateArguments(FunctionTemplate, HasExplicitTemplateArgs,
+                                      ExplicitTemplateArgs,
+                                      NumExplicitTemplateArgs,
                                       FunctionType, Specialization, Info)) {
         // FIXME: make a note of the failed deduction for diagnostics.
         (void)Result;





More information about the cfe-commits mailing list