Fix serialization of native integral types - #11
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes MsgPack serialization for native integral types (e.g., std::size_t) whose underlying type may not be one of the fixed-width integer typedefs, preventing them from incorrectly falling into the custom-object pack()/unpack() fallback.
Changes:
- Added
pack_type/unpack_typeoverloads to route otherwise-unhandledstd::integraltypes through existing fixed-width integer serialization. - Excluded integral types from the custom-object fallback overloads so they don’t attempt
value.pack()/value.unpack().
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
=======================================
Coverage 93.91% 93.91%
=======================================
Files 1 1
Lines 493 493
=======================================
Hits 463 463
Misses 30 30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix serialization of native integral types that are not aliases of the
fixed-width integer types handled by the existing overloads.
On macOS,
std::size_tisunsigned long, whilestd::uint64_tmay bea different underlying type. As a result,
std::size_tcould fall throughto the custom-object overload and attempt to call
value.pack()/value.unpack().This change routes otherwise-unhandled integral types through the existing
fixed-width integer serialization overloads and excludes integral types from
the custom-object fallback.
Testing
std::vector<std::size_t>array test now compilesctest --test-dir build --output-on-failure