Index: lib/CodeGen/CGExprAgg.cpp
===================================================================
--- lib/CodeGen/CGExprAgg.cpp	(revision 160248)
+++ lib/CodeGen/CGExprAgg.cpp	(working copy)
@@ -1360,6 +1360,17 @@
     }
   }
   
+  if (CGM.getLangOpts().CPlusPlus && !Ty.isPODType(getContext()) &&
+      Ty->isRecordType()) {
+    if (const RecordType *RecordTy = Ty->getAs<RecordType>()) {
+      // Do not copy the tail padding of non-POD types, as the compiler will
+      // reuse it for fields of derived classes
+      const ASTRecordLayout &Layout =
+        getContext().getASTRecordLayout(RecordTy->getDecl());
+      TypeInfo.first = Layout.getDataSize();
+    }
+  }
+  
   Builder.CreateMemCpy(DestPtr, SrcPtr,
                        llvm::ConstantInt::get(IntPtrTy, 
                                               TypeInfo.first.getQuantity()),
