fix array end handling for first variant alternative in parse_into - #1195
fix array end handling for first variant alternative in parse_into#1195Ramya-9353 wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C7uBZYRF8M5U3w49QLn4nW
|
GCOVR code coverage report https://1195.json.prtest2.cppalliance.org/gcovr/index.html Build time: 2026-09-04 18:31:48 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1195 +/- ##
===========================================
- Coverage 93.72% 93.69% -0.03%
===========================================
Files 85 85
Lines 8981 8981
===========================================
- Hits 8417 8415 -2
- Misses 564 566 +2
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
|

Repro: parse_into a
std::vector<variant2::variant<std::vector<int>, int>>from[[1],2]; it fails witherror::not_array, while the alternatives-swappedvariant<int, std::vector<int>>accepts the same document. Avariant<std::array<int,3>>parsed from[1]reports success and leaves two elements unwritten; nesting such a variant in a map trips theBOOST_ASSERT(false)path inhandler_error_base::on_object_endon debug builds.Cause: the variant handler's
on_array_endtests itsintsentinel with!inner_active_, which is only true for index 0, so while the first alternative is mid-array its closing bracket is routed tosignal_endand terminates the variant instead of reaching the active alternative. The completeness check of the aborted alternative never runs.Fix: compare
inner_active_ < 0, matching the sentinel checks elsewhere in the file. The added tests fail before the change and pass after.🤖 Generated with Claude Code
https://claude.ai/code/session_01C7uBZYRF8M5U3w49QLn4nW