diff options
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 6 | ||||
-rw-r--r-- | test/CodeGenCXX/new.cpp | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 4b8e733f4d..9e20530711 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -295,9 +295,11 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { const Expr *Init = E->getConstructorArg(0); - if (!hasAggregateLLVMType(AllocType)) { + if (!hasAggregateLLVMType(AllocType)) Builder.CreateStore(EmitScalarExpr(Init), NewPtr); - } else { + else if (AllocType->isAnyComplexType()) + EmitComplexExprIntoAddr(Init, NewPtr, AllocType.isVolatileQualified()); + else { ErrorUnsupported(E, "new expression"); return llvm::UndefValue::get(ConvertType(E->getType())); } diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp index a1786e8181..dde7bfe9ee 100644 --- a/test/CodeGenCXX/new.cpp +++ b/test/CodeGenCXX/new.cpp @@ -13,4 +13,6 @@ void t2(int* a) { void t3() { int *a = new int(10); + _Complex int* b = new _Complex int(10i); + } |