Skip to content

v4.7.2: Fix inspection_guarded to exclude types with explicit serializers

Choose a tag to compare

@eyalz800 eyalz800 released this 14 Jul 13:13
· 6 commits to main since this release
Types with archive-based explicit serializers (like optional_ptr, or
types with private fields and custom serialize functions) were not
covered by inspection_guarded. On GCC 16 / C++26
(__cpp_structured_bindings >= 202411L) the library then attempted
structured binding decomposition of these types, causing a
compilation failure (optional_ptr derives from std::unique_ptr, whose
members are inaccessible, and is neither aggregate nor tuple-like).

Add has_explicit_serialize<Type> to the inspection_guarded concept so
the structured binding path is never taken for any type that already
has an explicit serializer. number_of_members is never consumed for
such types (serialize_one dispatches to the explicit serialize first),
so returning -1 for them is safe.

Add test_inspection_guarded and test_issue_207_repro covering the
concept guarantees and representative round-trips, and extend the CI
matrix (GCC 13/14/16, Clang 19/21) to exercise the C++26 path.

Fixes #207

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>