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:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user