Fix crash during user_defined_conversions_2

Temporaries created during user conversion operations were being dropped
before the result of the conversion was able to be used. This fixes that
by temporarily storing the result of the conversion inside the
current Function_Push_Pop context.
This commit is contained in:
Jason Turner
2014-11-02 21:37:01 -07:00
parent 20c0e6016e
commit c876a89030
7 changed files with 103 additions and 8 deletions

View File

@@ -67,6 +67,7 @@ namespace chaiscript
Data &operator=(Data &&rhs) = default;
#endif
Type_Info m_type_info;
chaiscript::detail::Any m_obj;
void *m_data_ptr;
@@ -122,6 +123,13 @@ namespace chaiscript
return get(std::ref(*t));
}
template<typename T>
static std::shared_ptr<Data> get(const T *t)
{
return get(std::cref(*t));
}
template<typename T>
static std::shared_ptr<Data> get(std::reference_wrapper<T> obj)
{