diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 9e2053071103..febfbacf7cc9 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/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/clang/test/CodeGenCXX/new.cpp b/clang/test/CodeGenCXX/new.cpp index dde7bfe9ee57..bf959c95c851 100644 --- a/clang/test/CodeGenCXX/new.cpp +++ b/clang/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); }