[cfe-commits] r95076 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/temporaries.cpp

Anders Carlsson andersca at mac.com
Mon Feb 1 23:10:35 PST 2010


Author: andersca
Date: Tue Feb  2 01:10:35 2010
New Revision: 95076

URL: http://llvm.org/viewvc/llvm-project?rev=95076&view=rev
Log:
Check in a test case and a nasty workaround for PR6199.

Modified:
    cfe/trunk/lib/CodeGen/CGExprCXX.cpp
    cfe/trunk/test/CodeGenCXX/temporaries.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Feb  2 01:10:35 2010
@@ -309,7 +309,9 @@
   if (getContext().getLangOptions().ElideConstructors && E->isElidable()) {
     const Expr *Arg = E->getArg(0);
     
-    if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
+    // FIXME: This 'while' statement should really be an 'if' statement, it's 
+    // added as a workaround for PR6199.
+    while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
       assert((ICE->getCastKind() == CastExpr::CK_NoOp ||
               ICE->getCastKind() == CastExpr::CK_ConstructorConversion ||
               ICE->getCastKind() == CastExpr::CK_UserDefinedConversion) &&

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

==============================================================================
--- cfe/trunk/test/CodeGenCXX/temporaries.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/temporaries.cpp Tue Feb  2 01:10:35 2010
@@ -249,3 +249,21 @@
     g2(17);
   }
 }
+
+// PR6199
+namespace PR6199 {
+  struct A { ~A(); };
+
+  struct B { operator A(); };
+
+  // CHECK: define void @_ZN6PR61992f2IiEENS_1AET_
+  template<typename T> A f2(T) {
+    B b;
+    // CHECK: call void @_ZN6PR61991BcvNS_1AEEv
+    // CHECK-NEXT: ret void
+    return b;
+  }
+
+  template A f2<int>(int);
+  
+}





More information about the cfe-commits mailing list