Add support for calls to dependent names within templates, e.g.,

  template<typename T> void f(T x) {
    g(x); // g is a dependent name, so don't even bother to look it up
    g(); // error: g is not a dependent name
  }

Note that when we see "g(", we build a CXXDependentNameExpr. However,
if none of the call arguments are type-dependent, we will force the
resolution of the name "g" and replace the CXXDependentNameExpr with
its result.

GCC actually produces a nice error message when you make this
mistake, and even offers to compile your code with -fpermissive. I'll
do the former next, but I don't plan to do the latter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60618 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 85cd2c8..b396e1c 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -461,7 +461,7 @@
                                         SourceLocation RParenLoc);
 
   ExprResult 
-  BuildCallToObjectOfClassType(Expr *Object, SourceLocation LParenLoc,
+  BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc,
                                Expr **Args, unsigned NumArgs,
                                SourceLocation *CommaLocs, 
                                SourceLocation RParenLoc);
@@ -643,7 +643,8 @@
   ExprResult ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
                                       DeclarationName Name,
                                       bool HasTrailingLParen,
-                                      const CXXScopeSpec *SS);
+                                      const CXXScopeSpec *SS,
+                                      bool ForceResolution = false);
                                       
 
   virtual ExprResult ActOnPredefinedExpr(SourceLocation Loc,
@@ -681,7 +682,8 @@
   /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
   /// This provides the location of the left/right parens and a list of comma
   /// locations.
-  virtual ExprResult ActOnCallExpr(ExprTy *Fn, SourceLocation LParenLoc,
+  virtual ExprResult ActOnCallExpr(Scope *S, ExprTy *Fn, 
+                                   SourceLocation LParenLoc,
                                    ExprTy **Args, unsigned NumArgs,
                                    SourceLocation *CommaLocs,
                                    SourceLocation RParenLoc);