Fixes assertion
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/Support/Casting.h, line 255.
It was triggered by trying to cast FunctionDecl to CXXMethodDecl as
CGF.CurCodeDecl in CallBaseDtor::Emit. It was happening because
cleanups were emitted in ScalarExprEmitter::VisitExprWithCleanups
after destroying InlinedInheritingConstructorScope, so
CodeGenFunction.CurCodeDecl didn't correspond to expected cleanup decl.
Fix the assertion by emitting cleanups before leaving
InlinedInheritingConstructorScope and changing CurCodeDecl.
rdar://problem/45805151