Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74175 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 377d2fb..16a62fd 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1666,6 +1666,9 @@
 /// getDecltypeForExpr - Given an expr, will return the decltype for that
 /// expression, according to the rules in C++0x [dcl.type.simple]p4
 static QualType getDecltypeForExpr(const Expr *e, ASTContext &Context) {
+  if (e->isTypeDependent())
+    return Context.DependentTy;
+  
   // If e is an id expression or a class member access, decltype(e) is defined
   // as the type of the entity named by e.
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(e)) {