summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/value-init.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-22 16:15:35 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-22 16:15:35 +0000
commit759e41baf6a95c3a265970b6bf1c97c233fd28b0 (patch)
tree182e49c0fcd354505d5a81b9472d458f2d54d1a0 /test/CodeGenCXX/value-init.cpp
parente14add4a275318e7a9cafd3a01f79fb15a5a08bc (diff)
When performing value-initialization for a class with a non-trivial,
implicitly-defined default constructor, zero-initialize the memory before calling the default constructor. Previously, we would only zero-initialize in the case of a trivial default constructor. Also, simplify the hideous logic that determines when we have a trivial default constructor and, therefore, don't need to emit any call at all. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/value-init.cpp')
-rw-r--r--test/CodeGenCXX/value-init.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp
index 327362836b..6977e73e8b 100644
--- a/test/CodeGenCXX/value-init.cpp
+++ b/test/CodeGenCXX/value-init.cpp
@@ -93,4 +93,22 @@ namespace zeroinit {
// CHECK: ret i32
return S().i;
}
+
+ struct X0 {
+ X0() { }
+ int x;
+ };
+
+ struct X1 : X0 {
+ int x1;
+ void f();
+ };
+
+ // CHECK: define void @_ZN8zeroinit9testX0_X1Ev
+ void testX0_X1() {
+ // CHECK: call void @llvm.memset.p0i8.i64
+ // CHECK-NEXT: call void @_ZN8zeroinit2X1C1Ev
+ // CHECK-NEXT: call void @_ZN8zeroinit2X11fEv
+ X1().f();
+ }
}