]> granicus.if.org Git - clang/commitdiff
Check in a test case and a nasty workaround for PR6199.
authorAnders Carlsson <andersca@mac.com>
Tue, 2 Feb 2010 07:10:35 +0000 (07:10 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 2 Feb 2010 07:10:35 +0000 (07:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95076 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 4253d18c390a3a6f3212de0425649557789619c3..8dd747240aaf9b755d5f2acee322d3e81e9ed5d7 100644 (file)
@@ -309,7 +309,9 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest,
   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) &&
index 611781886b3ec31a22cc4d55b83a5681b5f9d132..c33ca4ebff2446d5d3bbeb19733712ce10af4428 100644 (file)
@@ -249,3 +249,21 @@ namespace PR5867 {
     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);
+  
+}