From e135ac348d6b72e98bc5f2d5458a9f5b96e50bbe Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 20 Sep 2021 05:29:43 +1000 Subject: [PATCH] util/delegate.cpp: Fixed calculation of this pointer when casting member function pointers across virtual inheritance relationships using MSVC with /vmg. --- src/lib/util/delegate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/util/delegate.cpp b/src/lib/util/delegate.cpp index ffe3b060784..33d5f8d54e8 100644 --- a/src/lib/util/delegate.cpp +++ b/src/lib/util/delegate.cpp @@ -126,7 +126,8 @@ void delegate_mfp_msvc::adjust_this_pointer(delegate_generic_class *&object) con std::uint8_t *byteptr = reinterpret_cast(object); if ((sizeof(unknown_base_equiv) == m_size) && m_vt_index) { - std::uint8_t const *const vptr = *reinterpret_cast(byteptr + m_vptr_offs); + byteptr += m_vptr_offs; + std::uint8_t const *const vptr = *reinterpret_cast(byteptr); byteptr += *reinterpret_cast(vptr + m_vt_index); } if (sizeof(single_base_equiv) < m_size)