Skip to content

fix dropped storage in single-element value(initializer_list) - #1184

Open
Ramya-9353 wants to merge 1 commit into
boostorg:developfrom
Ramya-9353:value-init-list-storage
Open

fix dropped storage in single-element value(initializer_list)#1184
Ramya-9353 wants to merge 1 commit into
boostorg:developfrom
Ramya-9353:value-init-list-storage

Conversation

@Ramya-9353

Copy link
Copy Markdown
Contributor

Repro: value jv({{1, 2, 3}}, sp) reports jv.storage() as the default resource rather than sp; the two-or-more element and object list forms adopt sp correctly.
Cause: the size()==1 branch of value(initializer_list<value_ref>, storage_ptr) constructs *this on the default resource with scalar(), builds the element on sp, then swaps; swap keeps each operand's own storage, so sp is discarded.
Fix: construct *this directly from the element's value, which already holds sp.

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1184.json.prtest2.cppalliance.org/libs/json/doc/html/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-08-08 11:23:53 UTC

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://1184.json.prtest2.cppalliance.org/gcovr/index.html
LCOV code coverage report https://1184.json.prtest2.cppalliance.org/genhtml/index.html
Coverage Diff Report https://1184.json.prtest2.cppalliance.org/diff-report/index.html

Build time: 2026-08-08 11:39:58 UTC

@cppalliance-bot

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants