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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84162 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp
index c235521..32d46b3 100644
--- a/test/CodeGenCXX/references.cpp
+++ b/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();
+}
+