Index: lib/CodeGen/CGClass.cpp =================================================================== --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -2180,6 +2180,7 @@ GlobalDecl GD(Ctor, CtorType); InlinedInheritingConstructorScope Scope(*this, GD); ApplyInlineDebugLocation DebugScope(*this, GD); + RunCleanupsScope CleanupScope(*this); // Save the arguments to be passed to the inherited constructor. CXXInheritedCtorInitExprArgs = Args; Index: test/CodeGenCXX/inheriting-constructor-cleanup.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/inheriting-constructor-cleanup.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -triple x86_64-linux -fexceptions -emit-llvm -o - %s | FileCheck %s + +// PR36748 +struct S { + ~S() {} +}; + +struct T { + T(int, ...) {} +}; + +struct U : public S, public T { + using T::T; +}; + +void f() { + U(0); +} + +// ~S cleanup should be emitted rather than crashing +// CHECK-LABEL: define void @_Z1fv +// CHECK: call void @_ZN1SD2Ev