Reinstate r142844 (reverted in r142872) now that lvalue-to-rvalue conversions
are present in all the necessary places:

In constant expression evaluation, evaluate lvalues as lvalues and rvalues as
rvalues. Remove special case for caching reference initialization and fix a
cyclic initialization crash in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143204 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/static-data-member.cpp b/test/CodeGenCXX/static-data-member.cpp
index b19067a..4eeda3d 100644
--- a/test/CodeGenCXX/static-data-member.cpp
+++ b/test/CodeGenCXX/static-data-member.cpp
@@ -64,3 +64,17 @@
   // CHECK-NEXT: br label
   // CHECK:      ret void
 }
+
+// Test that we can fold member lookup expressions which resolve to static data
+// members.
+namespace test4 {
+  struct A {
+    static const int n = 76;
+  };
+
+  int f(A *a) {
+    // CHECK: define i32 @_ZN5test41fEPNS_1AE
+    // CHECK: ret i32 76
+    return a->n;
+  }
+}