Fix PR6648 by not creating a temporary with the type of a

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.

llvm-svn: 99134
This commit is contained in:
Rafael Espindola 2010-03-21 17:11:05 +00:00
parent c91f200c17
commit 46b7987f85
2 changed files with 13 additions and 4 deletions

View 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);
}

View 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);
}
}