Use EmitStoreOfScalar when copying the scalar to the space allocated by 'new'.

llvm-svn: 89613
This commit is contained in:
Anders Carlsson 2009-11-22 19:25:33 +00:00
parent 00e9c6103b
commit 5838108317
2 changed files with 10 additions and 2 deletions

View File

@ -103,8 +103,9 @@ static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E,
const Expr *Init = E->getConstructorArg(0);
if (!CGF.hasAggregateLLVMType(AllocType))
CGF.Builder.CreateStore(CGF.EmitScalarExpr(Init), NewPtr);
if (!CGF.hasAggregateLLVMType(AllocType))
CGF.EmitStoreOfScalar(CGF.EmitScalarExpr(Init), NewPtr,
AllocType.isVolatileQualified(), AllocType);
else if (AllocType->isAnyComplexType())
CGF.EmitComplexExprIntoAddr(Init, NewPtr,
AllocType.isVolatileQualified());

View File

@ -72,3 +72,10 @@ void t8(int n) {
new U[10];
new U[n];
}
void t9() {
bool b;
new bool(true);
new (&b) bool(true);
}