Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record initialization with no designators #165

Merged
merged 8 commits into from
Jun 21, 2024
Prev Previous commit
Next Next commit
Fix clang-tidy
leewei05 committed Jun 21, 2024
commit 433a3bab58e2d2a70c5eafa37539477ce6d15320
3 changes: 2 additions & 1 deletion src/type.cpp
Original file line number Diff line number Diff line change
@@ -180,7 +180,8 @@ std::size_t StructType::offset(std::size_t index) const {
}

return std::accumulate(
fields_.cbegin(), std::next(fields_.cbegin(), index), std::size_t{0},
fields_.cbegin(), std::next(fields_.cbegin(), (long)index),
std::size_t{0},
[](auto&& size, auto&& field) { return size + field->type->size(); });
}