diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-02 07:10:35 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-02 07:10:35 +0000 |
commit | 75b1f959da8e4e9985b321a1f1c685296e924fc9 (patch) | |
tree | ead1810f165183dde3b3da80f44704e461b5d0d8 /clang | |
parent | 30678293f1184f2ab4c302fecdfc46885ae1a870 (diff) | |
download | bcm5719-llvm-75b1f959da8e4e9985b321a1f1c685296e924fc9.tar.gz bcm5719-llvm-75b1f959da8e4e9985b321a1f1c685296e924fc9.zip |
Check in a test case and a nasty workaround for PR6199.
llvm-svn: 95076
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGExprCXX.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/temporaries.cpp | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 4253d18c390..8dd747240aa 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -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) && diff --git a/clang/test/CodeGenCXX/temporaries.cpp b/clang/test/CodeGenCXX/temporaries.cpp index 611781886b3..c33ca4ebff2 100644 --- a/clang/test/CodeGenCXX/temporaries.cpp +++ b/clang/test/CodeGenCXX/temporaries.cpp @@ -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); + +} |