[svn r83] Fixed: Returning a struct from within the try block of a try-finally was broken.

This commit is contained in:
Tomas Lindquist Olsen
2007-10-31 22:20:19 +01:00
parent d8f021d63f
commit 44d2104eec
2 changed files with 22 additions and 1 deletions

View File

@@ -96,7 +96,7 @@ void ReturnStatement::toIR(IRState* p)
if (fin.empty())
new llvm::ReturnInst(p->scopebb());
else {
new llvm::BranchInst(fin.back().bb);
new llvm::BranchInst(fin.back().bb, p->scopebb());
fin.back().ret = true;
}
delete e;

21
test/bug44.d Normal file
View File

@@ -0,0 +1,21 @@
module bug44;
pragma(LLVM_internal, "notypeinfo")
struct rgb
{
long l;
}
void foo()
{
}
rgb test() {
scope(exit) foo();
return rgb();
}
void main()
{
rgb r = test();
}