fix: copy container elements before pop_back - #832
Conversation
|
I traced this through the generated container binding. The fix is in |
|
Ah, I see what you want to do. That should work, but only for classes with a copy constructor... |
|
That makes sense. I checked the generator path before replying: the helper is emitted only for the The full platform matrix is green now, including Android, iOS, Linux, macOS, Windows, and the platform job. If you know of a container type that reaches this generated path without a copy constructor, I can narrow the condition further. Let me know what you think. |
|
There's seems to be a bug in the Generator, it's not working properly. Please fix that as well |
|
I traced the remaining failure into the Generator rather than the parser helper. The I pushed I ran Maven far enough to generate rptr = new ::MoveOnlyData(std::move(getMoveOnlyData()));The local test then stops at the existing Windows limitation because |
|
|
|
I traced the failed platform jobs to the generated test binding rather than the move expression itself. The generator emitted In |
Signed-off-by: ahmadalguydi <ahmadalgaidy@hotmail.com>
|
I found the remaining failure in the test result: the move itself was producing the expected value, but the I fixed that path in |
|
This still doesn't work. If this is a feature you want to use, please add at least a test that looks like what you want to use it for, and make it actually work! |
Summary
pop_back()copy non-primitive elements before shrinking the native containerat()accessor for vector/deque-style containersThe previous generated sequence read an element by reference, called
resize(size - 1), and then returned the reference after its native object had been destroyed. The new accessor performs the copy while the element is still alive, then preserves the existing resize behavior.Closes #830
Validation
git diff --checkpassed