forked from OSchip/llvm-project
Use EmitStoreOfScalar when copying the scalar to the space allocated by 'new'.
llvm-svn: 89613
This commit is contained in:
parent
00e9c6103b
commit
5838108317
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue