parent_of_member: Make sign conversion explicit in OffsetOfImpl()

Previously these conversions were implicit and causing quite a few
warnings on clang.
This commit is contained in:
Lioncash 2021-05-10 08:06:19 -04:00
parent ec50a9b5b9
commit 0aff3ba2ff

View File

@ -109,7 +109,8 @@ struct OffsetOfCalculator {
} }
} }
return (next - start) * sizeof(MemberType) + Offset; return static_cast<ptrdiff_t>(static_cast<size_t>(next - start) * sizeof(MemberType) +
Offset);
} }
static constexpr std::ptrdiff_t OffsetOf(MemberType ParentType::*member) { static constexpr std::ptrdiff_t OffsetOf(MemberType ParentType::*member) {