]> granicus.if.org Git - clang/commitdiff
...and aggregate POD types.
authorAnders Carlsson <andersca@mac.com>
Sun, 31 May 2009 21:12:26 +0000 (21:12 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 31 May 2009 21:12:26 +0000 (21:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72676 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp
test/CodeGenCXX/new.cpp

index 9e20530711032e6fc058df1ab77cf03c2e4e9e1a..febfbacf7cc9b84f7c2c096d5ce3eb799bd56ac2 100644 (file)
@@ -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;
index dde7bfe9ee57f2426dd796de3e10af8716231f65..bf959c95c851dfce47e73592dd8a4b668858d2af 100644 (file)
@@ -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);
 }