If a member variable of reference type is bound to a temporary in its member initializer it needs to be destroyed at the end of the constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86230 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp
index 5366612..87ca9ca 100644
--- a/test/CodeGenCXX/temporaries.cpp
+++ b/test/CodeGenCXX/temporaries.cpp
@@ -131,6 +131,7 @@
int a1;
int a2;
B();
+ ~B();
};
B::B()
@@ -147,4 +148,20 @@
f();
}
+struct C {
+ C();
+
+ const B& b;
+};
+
+C::C()
+ // CHECK: call void @_ZN6PR50771BC1Ev
+ : b(B()) {
+ // CHECK: call void @_ZN6PR50771fEv
+ f();
+
+ // CHECK: call void @_ZN6PR50771BD1Ev
+}
+
+
}