Make the ".*" operator work correctly when the base is a prvalue and the field has a non-trivial copy constructor. PR13097.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158578 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp
index 90024e4..fe69cd5 100644
--- a/test/CodeGenCXX/pointers-to-data-members.cpp
+++ b/test/CodeGenCXX/pointers-to-data-members.cpp
@@ -240,3 +240,17 @@
// CHECK-GLOBAL: @_ZN7PR114871xE = global %"union.PR11487::U" { i64 -1, [8 x i8] zeroinitializer }, align 8
}
+
+namespace PR13097 {
+ struct X { int x; X(const X&); };
+ struct A {
+ int qq;
+ X x;
+ };
+ A f();
+ X g() { return f().*&A::x; }
+ // CHECK: define void @_ZN7PR130971gEv
+ // CHECK: call void @_ZN7PR130971fEv
+ // CHECK-NOT: memcpy
+ // CHECK: call void @_ZN7PR130971XC1ERKS0_
+}