Index: lib/AST/VTableBuilder.cpp =================================================================== --- lib/AST/VTableBuilder.cpp +++ lib/AST/VTableBuilder.cpp @@ -3737,6 +3737,8 @@ if (isa(GD.getDecl())) assert(GD.getDtorType() == Dtor_Deleting); + GD = GD.getCanonicalDecl(); + MethodVFTableLocationsTy::iterator I = MethodVFTableLocations.find(GD); if (I != MethodVFTableLocations.end()) return I->second; Index: test/CodeGenCXX/PR37481.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/PR37481.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -o /dev/null -emit-llvm -std=c++17 -triple x86_64-pc-windows-msvc %s + +struct Foo { + virtual void f(); + virtual void g(); +}; + +void Foo::f() {} +void Foo::g() {} + +template +void h() {} + +void x() { + h<&Foo::f>(); + h<&Foo::g>(); +}