[cfe-commits] r72676 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/new.cpp

Anders Carlsson andersca at mac.com
Sun May 31 14:12:26 PDT 2009


Author: andersca
Date: Sun May 31 16:12:26 2009
New Revision: 72676

URL: http://llvm.org/viewvc/llvm-project?rev=72676&view=rev
Log:
..and aggregate POD types.

Modified:
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/test/CodeGenCXX/new.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=72676&r1=72675&r2=72676&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sun May 31 16:12:26 2009
@@ -299,10 +299,8 @@
         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;

Modified: cfe/trunk/test/CodeGenCXX/new.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/new.cpp?rev=72676&r1=72675&r2=72676&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/new.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/new.cpp Sun May 31 16:12:26 2009
@@ -11,8 +11,15 @@
   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);
 }





More information about the cfe-commits mailing list