Merge pull request #6297 from lioncash/common-conv

parent_of_member: Make sign conversion explicit in OffsetOfImpl()
This commit is contained in:
bunnei 2021-05-19 18:43:47 -07:00 committed by GitHub
commit b5d21cc1b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

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) {