When emitting l-values for bool non-__block decl references, make a pointer

using the memory type;  fixes an assert.

Fixes rdar://problem/8605032

llvm-svn: 117610
This commit is contained in:
John McCall 2010-10-28 21:37:57 +00:00
parent f20f79808e
commit 565141612f
2 changed files with 8 additions and 1 deletions

View File

@ -611,7 +611,7 @@ llvm::Value *CodeGenFunction::GetAddrOfBlockDecl(const ValueDecl *VD,
if (VD->getType()->isReferenceType())
V = Builder.CreateLoad(V);
} else {
const llvm::Type *Ty = CGM.getTypes().ConvertType(VD->getType());
const llvm::Type *Ty = CGM.getTypes().ConvertTypeForMem(VD->getType());
Ty = llvm::PointerType::get(Ty, 0);
V = Builder.CreateBitCast(V, Ty);
if (VD->getType()->isReferenceType())

View File

@ -33,3 +33,10 @@ typedef double ftype(double);
ftype ^test2 = ^ftype {
return 0;
};
// rdar://problem/8605032
void f3_helper(void (^)(void));
void f3() {
_Bool b = 0;
f3_helper(^{ if (b) {} });
}