Handle

struct A { };
struct B : A { };

void f() {
  const A& a = B();
}

correctly. (This now does the offset conversion if necessary and calls the destructor when a goes out of scope).

llvm-svn: 84162
diff --git a/clang/test/CodeGenCXX/references.cpp b/clang/test/CodeGenCXX/references.cpp
index c235521..32d46b3 100644
--- a/clang/test/CodeGenCXX/references.cpp
+++ b/clang/test/CodeGenCXX/references.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -emit-llvm -o %t %s
+// RUN: clang-cc -verify -emit-llvm -o - %s | FileCheck %s
 
 void t1() {
   extern int& a;
@@ -100,3 +100,10 @@
 void *foo = 0;
 void * const & kFoo = foo;
 
+struct D : C { D(); ~D(); };
+
+void h() {
+  // CHECK: call void @_ZN1DD1Ev
+  const C& c = D();
+}
+