[cfe-commits] r157138 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/cxx0x-delegating-ctors.cpp
Eli Friedman
eli.friedman at gmail.com
Sat May 19 17:46:05 PDT 2012
Author: efriedma
Date: Sat May 19 19:46:05 2012
New Revision: 157138
URL: http://llvm.org/viewvc/llvm-project?rev=157138&view=rev
Log:
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.
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=157138&r1=157137&r2=157138&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Sat May 19 19:46:05 2012
@@ -409,7 +409,6 @@
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;
Modified: cfe/trunk/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx0x-delegating-ctors.cpp?rev=157138&r1=157137&r2=157138&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/cxx0x-delegating-ctors.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/cxx0x-delegating-ctors.cpp Sat May 19 19:46:05 2012
@@ -54,3 +54,14 @@
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)
More information about the cfe-commits
mailing list