You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pmr::json dest uses the default constructor, which creates an empty object, with no space allocated for members, hence no need yet for an allocator object.
The statement
dest["bar"] = "foo";
attempts to add a member to the empty object. jsoncons now needs to allocate space for the member, but it will only do so if it detects that the allocator type is stateless, e.g. std::allocator or another allocator type that doesn't hold state. std::pmr::polymorphic_allocator is a stateful allocator, jsoncons detects that, and fails. I had intended that to be a compile time error, and so used a static_assert, but in fact it isn't detected until runtime, which is why it crashed so unceremoniously. I've replaced the static_assert with a runtime exception in the main branch.
Normally you would create a pmr::json something like
Describe the bug
the code below crashes
should not crash
Enumerate the steps to reproduce the bug
Include a small, self-contained example if possible
What compiler, architecture, and operating system?
What jsoncons library version?
The text was updated successfully, but these errors were encountered: