diff --git a/src/common/parent_of_member.h b/src/common/parent_of_member.h index d9a14529de..e0f8ab5c8a 100644 --- a/src/common/parent_of_member.h +++ b/src/common/parent_of_member.h @@ -133,27 +133,27 @@ template using GetMemberType = typename GetMemberPointerTraits::Member; template > -static inline std::ptrdiff_t OffsetOf = [] { +constexpr std::ptrdiff_t OffsetOf() { using DeducedParentType = GetParentType; using MemberType = GetMemberType; static_assert(std::is_base_of::value || std::is_same::value); return OffsetOfCalculator::OffsetOf(MemberPtr); -}(); +}; } // namespace impl template > constexpr RealParentType& GetParentReference(impl::GetMemberType* member) { - std::ptrdiff_t Offset = impl::OffsetOf; + std::ptrdiff_t Offset = impl::OffsetOf(); return *static_cast( static_cast(static_cast(static_cast(member)) - Offset)); } template > constexpr RealParentType const& GetParentReference(impl::GetMemberType const* member) { - std::ptrdiff_t Offset = impl::OffsetOf; + std::ptrdiff_t Offset = impl::OffsetOf(); return *static_cast(static_cast( static_cast(static_cast(member)) - Offset)); }