You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using the v4.0.0-alpha branch for a while, and thought I would upgrade to the tip of the develop branch to get the latest fixes and improvements. Unfortunately there seems to be a regression, because my project no longer runs correctly. I have struggled to debug what the issue exactly is, and to reproduce a minimal example, so instead I just investigated with a git bisect in sol2.
I narrowed it down to ff783a1, which changes meta::is_cstr_of to not include std::string.
I noticed a few things that looked suspicious to me, and after fixing them, my issues disappear. Some of it might be my misunderstanding of what the code does, sol2 is very complex, but it seems to have done the trick.
Although most occurences of is_cstr_v in "stack_field.hpp" were changed to is_cstr_or_string_v, there was one line that used to be
I assume this code is meant to transform stuff like Fq=char[26] into const char* for storage. But this looks weird, as it would turn Fq=std::string into F=const std::string*, which would lead to a dangling pointer once the std::string goes out of scope. I changed it to use is_c_str_of only.
I have been using the
v4.0.0-alpha
branch for a while, and thought I would upgrade to the tip of thedevelop
branch to get the latest fixes and improvements. Unfortunately there seems to be a regression, because my project no longer runs correctly. I have struggled to debug what the issue exactly is, and to reproduce a minimal example, so instead I just investigated with agit bisect
in sol2.I narrowed it down to ff783a1, which changes
meta::is_cstr_of
to not includestd::string
.I noticed a few things that looked suspicious to me, and after fixing them, my issues disappear. Some of it might be my misunderstanding of what the code does, sol2 is very complex, but it seems to have done the trick.
Although most occurences of
is_cstr_v
in "stack_field.hpp" were changed tois_cstr_or_string_v
, there was one line that used to besol2/include/sol/stack_field.hpp
Line 215 in 7aae1aa
and got changed to just
sol2/include/sol/stack_field.hpp
Line 215 in 50b62c9
That seems like an omission to me, so I changed it to
is_cstr_or_string_v<T>
.In "usertype_storage.hpp", the code now reads
sol2/include/sol/usertype_storage.hpp
Lines 66 to 75 in 50b62c9
I assume this code is meant to transform stuff like
Fq=char[26]
intoconst char*
for storage. But this looks weird, as it would turnFq=std::string
intoF=const std::string*
, which would lead to a dangling pointer once thestd::string
goes out of scope. I changed it to useis_c_str_of
only.In "traits.hpp"
sol2/include/sol/traits.hpp
Lines 701 to 702 in 50b62c9
Looks wrong. I changed it to
= is_c_str_or_string<T>::value
.It was after fixing point 3 that my problem disappeared.
The text was updated successfully, but these errors were encountered: