When constant folding reference variables with an initializer to the
initializer, don't fold paramters. Their initializers are just default
arguments which can be overridden. This fixes some spectacular regressions due
to more things making it into the constant folding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103904 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index f903035..dc61401 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -355,6 +355,10 @@
   } else if (VarDecl* VD = dyn_cast<VarDecl>(E->getDecl())) {
     if (!VD->getType()->isReferenceType())
       return Success(E);
+    // Reference parameters can refer to anything even if they have an
+    // "initializer" in the form of a default argument.
+    if (isa<ParmVarDecl>(VD))
+      return false;
     // FIXME: Check whether VD might be overridden!
     if (const Expr *Init = VD->getAnyInitializer())
       return Visit(const_cast<Expr *>(Init));