sol2/tests/regression_tests/simple/source/1072.cpp
ThePhD d39330eab9
Overhaul function calls and usage
- add noexcept to some of the core function calls
- type usage for both trampolines and yields can now be fully tracked, at the expense of more template instantiations when using both
- exceptions should be less prone to explosion in C versions, but will break in C++ code (the trampolines need to be modified for usertype calls to avoid this problem, specifically)
2020-12-17 23:25:48 -05:00

13 lines
363 B
C++

#include <sol/sol.hpp>
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;
}