Allow EmitConstantInit() to emit constant initializers for objects with trivial constructors and non-trivial destructors. Test that such objects are ignored by init-order checker.
llvm-svn: 178856
This commit is contained in:
@@ -1018,8 +1018,7 @@ llvm::Constant *CodeGenModule::EmitConstantInit(const VarDecl &D,
|
||||
if (const CXXConstructExpr *E =
|
||||
dyn_cast_or_null<CXXConstructExpr>(D.getInit())) {
|
||||
const CXXConstructorDecl *CD = E->getConstructor();
|
||||
if (CD->isTrivial() && CD->isDefaultConstructor() &&
|
||||
Ty->getAsCXXRecordDecl()->hasTrivialDestructor())
|
||||
if (CD->isTrivial() && CD->isDefaultConstructor())
|
||||
return EmitNullConstant(D.getType());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user