]> granicus.if.org Git - clang/commitdiff
When replacing a template-id expression with a declaration reference expression after...
authorDouglas Gregor <dgregor@apple.com>
Thu, 22 Oct 2009 18:02:20 +0000 (18:02 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 22 Oct 2009 18:02:20 +0000 (18:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84880 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp

index bcca6ece80b33f18f12f651a46d11690e00129c2..ebcf3ad8e2bcf7b3637aa4d7e2337c65e6c863b3 100644 (file)
@@ -5383,6 +5383,8 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn) {
                                                 ClassType.getTypePtr()));
         return E;
       }
+      // FIXME: TemplateIdRefExpr referring to a member function template
+      // specialization!
     }
     Expr *NewExpr = FixOverloadedFunctionReference(UnOp->getSubExpr(), Fn);
     UnOp->setSubExpr(NewExpr);
@@ -5399,10 +5401,17 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn) {
     MemExpr->setMemberDecl(Fn);
     E->setType(Fn->getType());
   } else if (TemplateIdRefExpr *TID = dyn_cast<TemplateIdRefExpr>(E)) {
-    // FIXME: Should we create QualifiedDeclRefExprs here too?
     // FIXME: We should capture the template arguments here.
-    E = new (Context) DeclRefExpr(Fn, Fn->getType(), 
-                                  TID->getSourceRange().getBegin());
+    if (NestedNameSpecifier *Qualifier = TID->getQualifier())
+      E = new (Context) QualifiedDeclRefExpr(Fn, Fn->getType(),
+                                             TID->getTemplateNameLoc(),
+                                             /*FIXME?*/false, /*FIXME?*/false,
+                                             TID->getQualifierRange(),
+                                             Qualifier);
+    else
+      E = new (Context) DeclRefExpr(Fn, Fn->getType(), 
+                                    TID->getTemplateNameLoc());
+    
     TID->Destroy(Context);
   } else {
     assert(false && "Invalid reference to overloaded function");