When finishing a function definition, leave the function definition *after*
doing all the cleanup tasks and checks. This gives us the proper context for checking access to base and member destructors. llvm-svn: 99559
This commit is contained in:
parent
f9c4585c80
commit
e99d5f3044
|
@ -4336,8 +4336,6 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,
|
|||
Body->Destroy(Context);
|
||||
return DeclPtrTy();
|
||||
}
|
||||
if (!IsInstantiation)
|
||||
PopDeclContext();
|
||||
|
||||
// Verify and clean out per-function state.
|
||||
|
||||
|
@ -4419,6 +4417,9 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,
|
|||
assert(ExprTemporaries.empty() && "Leftover temporaries in function");
|
||||
}
|
||||
|
||||
if (!IsInstantiation)
|
||||
PopDeclContext();
|
||||
|
||||
PopFunctionOrBlockScope();
|
||||
|
||||
// If any errors have occurred, clear out any temporaries that may have
|
||||
|
|
|
@ -283,3 +283,15 @@ namespace test10 {
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
namespace test11 {
|
||||
class A {
|
||||
protected: virtual ~A();
|
||||
};
|
||||
|
||||
class B : public A {
|
||||
~B();
|
||||
};
|
||||
|
||||
B::~B() {};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue