diff options
-rw-r--r-- | lib/CodeGen/CGCXXExpr.cpp | 5 | ||||
-rw-r--r-- | test/CodeGenCXX/new.cpp | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/CGCXXExpr.cpp b/lib/CodeGen/CGCXXExpr.cpp index 409296f716..845669d402 100644 --- a/lib/CodeGen/CGCXXExpr.cpp +++ b/lib/CodeGen/CGCXXExpr.cpp @@ -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()); diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp index 3f191de23b..ddf1f9b3c9 100644 --- a/test/CodeGenCXX/new.cpp +++ b/test/CodeGenCXX/new.cpp @@ -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); +} |