leftibot 5a6050210d
Fix #594: Map keys become dangling references when pushed into Vector (#650)
The Handle_Return_Ref specialization for const references was wrapping
return values in std::cref() while marking them as return values
(is_return_value=true). This caused Vector.push_back() to store the
reference directly without cloning, since it assumes return values are
freshly created temporaries. When the source object (e.g., a map) went
out of scope, the vector contained dangling references to freed memory.

The fix sets is_return_value=false for const reference returns, which
correctly triggers push_back to clone the value instead of storing a
bare reference. This is consistent with the non-const reference handler
(Handle_Return<Ret &>) which also does not set the return value flag.

Co-authored-by: leftibot <leftibot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 16:39:19 -06:00
..
dispatchkit Fix #594: Map keys become dangling references when pushed into Vector (#650) 2026-04-12 16:39:19 -06:00
language Fix #634: Add divide-by-zero check for modulo assignment operator (#672) 2026-04-12 16:28:41 -06:00
utility Fix #477: Handle \u unicode escape sequences in JSON parser 2026-04-10 19:49:48 -06:00
chaiscript_basic.hpp change .clang-format and reformat code with clang-format 11 2021-05-24 10:44:15 +02:00
chaiscript_defines.hpp Fix #146: Add configuration to bypass the registering of 'built-in' functions. (#642) 2026-04-11 16:49:13 -06:00
chaiscript_stdlib.hpp Fix #146: Add configuration to bypass the registering of 'built-in' functions. (#642) 2026-04-11 16:49:13 -06:00
chaiscript_threading.hpp change .clang-format and reformat code with clang-format 11 2021-05-24 10:44:15 +02:00
chaiscript.hpp Fix #571: How to redirect "cout" and "print" to a microsoft Windows 10 window? (#657) 2026-04-11 18:58:09 -06:00