sol2/tests/regression_tests/simple/source/1072 - capture exception propagation.cpp
ThePhD b9115623b2
Overhaul stack_field tableless handlers
- Ensure stack field_get/field_set has consistent metaprogramming for needing a pushed table, and at what offset
- Avoid duplicate logic in table_core for the same logic by deferring to detail helper
- Fixes #1095
2020-12-29 21:50:16 -05:00

13 lines
372 B
C++

#include <sol/sol.hpp>
unsigned int regression_1072() {
auto st = sol::state {};
// If you remove the capture, the problem goes away.
st["foo"] = [&] { throw std::runtime_error(""); };
sol::protected_function_result result = st.safe_script("foo()", sol::script_pass_on_error);
if (!result.valid()) {
sol::error err = result;
return 0;
}
return 1;
}