]> granicus.if.org Git - clang/commitdiff
Fix PR6648 by not creating a temporary with the type of a
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 21 Mar 2010 17:11:05 +0000 (17:11 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 21 Mar 2010 17:11:05 +0000 (17:11 +0000)
CXXExprWithTemporaries.

Not emitting the expression as an aggregate might be the right thing to do,
but is orthogonal. Emitting it as an scalar expression will still try to
create a temporary for the incomplete type of the CXXExprWithTemporaries and
fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99134 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp
test/CodeGenCXX/temporaries.cpp

index 4847ca3f824839588364d214df8ab88681f1fb3a..fa2d04f346f57edc0ffc69314f5ee975c66dcdfd 100644 (file)
@@ -500,10 +500,6 @@ AggExprEmitter::VisitCXXConstructExpr(const CXXConstructExpr *E) {
 void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
   llvm::Value *Val = DestPtr;
 
-  if (!Val) {
-    // Create a temporary variable.
-    Val = CGF.CreateMemTemp(E->getType(), "tmp");
-  }
   CGF.EmitCXXExprWithTemporaries(E, Val, VolatileDest, IsInitializer);
 }
 
index cd0cf77f53b2dd8115556a232e342102eb1e870c..4aad3c0056ca05b21178a7a02f7769b770076d7a 100644 (file)
@@ -288,3 +288,16 @@ void g() {
 }
 
 }
+
+namespace PR6648 {
+  struct B {
+    ~B();
+  };
+  B foo;
+  struct D;
+  D& zed(B);
+  void foobar() {
+    // CHECK: call %"struct.PR6648::D"* @_ZN6PR66483zedENS_1BE
+    zed(foo);
+  }
+}