Index: clang/lib/CodeGen/CGClass.cpp =================================================================== --- clang/lib/CodeGen/CGClass.cpp +++ clang/lib/CodeGen/CGClass.cpp @@ -2196,6 +2196,7 @@ GlobalDecl GD(Ctor, CtorType); InlinedInheritingConstructorScope Scope(*this, GD); ApplyInlineDebugLocation DebugScope(*this, GD); + RunCleanupsScope RunCleanups(*this); // Save the arguments to be passed to the inherited constructor. CXXInheritedCtorInitExprArgs = Args; Index: clang/test/CodeGenCXX/throw-expressions.cpp =================================================================== --- clang/test/CodeGenCXX/throw-expressions.cpp +++ clang/test/CodeGenCXX/throw-expressions.cpp @@ -112,3 +112,20 @@ // CHECK: ret i32* @val return cond ? val : ((throw "foo")); } + +// Test throwing object with inlined inherited constructor and non-trivial cleanup. +namespace rdar45805151 { + struct BaseException { + // Use variadic args to force inlining the inherited constructor. + BaseException(const char *format, ...) {} + // Add explicit destructor to make it non-trivial. + ~BaseException() {} + }; + struct BadException : public BaseException { + using BaseException::BaseException; + }; + + void test9() { + throw BadException("foo"); + } +}