Don't try to fold DeclRefExprs that point to ParmVarDecls. This had the side-effect of always folding the expression to the default argument of the parameter. For example:

void f(int a = 10) {
  return a;
}

would always return 10, regardless of the passed in argument.

This fixes another 600 test failures. We're now down to only 137 failures!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95262 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/member-initializers.cpp b/test/CodeGenCXX/member-initializers.cpp
index 1a27b7d..81dcee7 100644
--- a/test/CodeGenCXX/member-initializers.cpp
+++ b/test/CodeGenCXX/member-initializers.cpp
@@ -20,3 +20,15 @@
   return b.i;
 }
 
+// Test that we don't try to fold the default value of j when initializing i.
+// CHECK: define i32 @_Z9test_foldv() nounwind
+int test_fold() {
+  struct A {
+    A(const int j = 1) : i(j) { } 
+    int i;
+  };
+
+  // CHECK: ret i32 2
+  return A(2).i;
+}
+