Index: lib/CodeGen/CodeGenModule.h =================================================================== --- lib/CodeGen/CodeGenModule.h +++ lib/CodeGen/CodeGenModule.h @@ -320,7 +320,7 @@ /// referenced. These get code generated when the module is done. struct DeferredGlobal { DeferredGlobal(llvm::GlobalValue *GV, GlobalDecl GD) : GV(GV), GD(GD) {} - llvm::AssertingVH GV; + llvm::TrackingVH GV; GlobalDecl GD; }; std::vector DeferredDeclsToEmit; Index: test/CodeGenCXX/ctor-dtor-alias-assertingvh.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/ctor-dtor-alias-assertingvh.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -triple i686-linux -O1 -mconstructor-aliases -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-ITANIUM +// RUN: %clang_cc1 %s -triple i386-pc-win32 -O1 -mconstructor-aliases -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-MSVC + +namespace ns { + struct Base { + virtual ~Base(); + }; + + Base::~Base() { } + + template + struct Template { + struct NestedDerived : public Base { + virtual ~NestedDerived() { } + }; + }; +} + +namespace ns { + template class Template; + // CHECK-ITANIUM: $_ZN2ns8TemplateIiE13NestedDerivedD5Ev = comdat any + // CHECK-MSVC: @"\01??1NestedDerived@?$Template@H@ns@@UAE@XZ" = weak_odr alias bitcast (void (%"struct.ns::Base"*)* @"\01??1Base@ns@@UAE@XZ" to void (%"struct.ns::Template::NestedDerived"*)*) + +}