From 627a3e573f1d9f0429d62c7ceb742a21cdabfce0 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 31 May 2009 21:12:26 +0000 Subject: [PATCH] ...and aggregate POD types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72676 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGCXX.cpp | 6 ++---- test/CodeGenCXX/new.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 9e20530711..febfbacf7c 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -299,10 +299,8 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { Builder.CreateStore(EmitScalarExpr(Init), NewPtr); else if (AllocType->isAnyComplexType()) EmitComplexExprIntoAddr(Init, NewPtr, AllocType.isVolatileQualified()); - else { - ErrorUnsupported(E, "new expression"); - return llvm::UndefValue::get(ConvertType(E->getType())); - } + else + EmitAggExpr(Init, NewPtr, AllocType.isVolatileQualified()); } return NewPtr; diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp index dde7bfe9ee..bf959c95c8 100644 --- a/test/CodeGenCXX/new.cpp +++ b/test/CodeGenCXX/new.cpp @@ -11,8 +11,15 @@ void t2(int* a) { int* b = new (a) int; } +struct S { + int a; +}; + void t3() { int *a = new int(10); _Complex int* b = new _Complex int(10i); + S s; + s.a = 10; + S *sp = new S(s); } -- 2.40.0