summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-05-20 00:46:05 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-05-20 00:46:05 +0000
commit022900079ba10ebc64b6f3bea1ee5807ce39b3e2 (patch)
tree3537f984f3e5abcef58dad50edc0488e7c7a2117
parent4e1e43a355d55e376eeecb11d8f4fd6ff3b852fe (diff)
downloadbcm5719-llvm-022900079ba10ebc64b6f3bea1ee5807ce39b3e2.tar.gz
bcm5719-llvm-022900079ba10ebc64b6f3bea1ee5807ce39b3e2.zip
Zap a bogus assert for delegating constructors. PR12890, part 2.
I'm pretty sure we are in fact doing the right thing here, but someone who knows the standard better should double-check that we are in fact supposed to zero out the member in the given testcase. llvm-svn: 157138
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp1
-rw-r--r--clang/test/CodeGenCXX/cxx0x-delegating-ctors.cpp11
2 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index dc318bedf95..fa711e17e76 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -409,7 +409,6 @@ CodeGenFunction::EmitCXXConstructExpr(const CXXConstructExpr *E,
if (E->requiresZeroInitialization() && !Dest.isZeroed()) {
switch (E->getConstructionKind()) {
case CXXConstructExpr::CK_Delegating:
- assert(0 && "Delegating constructor should not need zeroing");
case CXXConstructExpr::CK_Complete:
EmitNullInitialization(Dest.getAddr(), E->getType());
break;
diff --git a/clang/test/CodeGenCXX/cxx0x-delegating-ctors.cpp b/clang/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
index f5684d93abd..65afbb9c2c3 100644
--- a/clang/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
+++ b/clang/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
@@ -54,3 +54,14 @@ delegator::delegator(char)
delegator::delegator(int)
: delegator()
{}
+
+namespace PR12890 {
+ class X {
+ int x;
+ X() = default;
+ X(int);
+ };
+ X::X(int) : X() {}
+}
+// CHECK: define {{.*}} @_ZN7PR128901XC1Ei(%"class.PR12890::X"* %this, i32)
+// CHECK: call void @llvm.memset.p0i8.i64(i8* {{.*}}, i8 0, i64 4, i32 4, i1 false)
OpenPOWER on IntegriCloud