Open deadlocklogic opened 7 months ago
I can repro that. In Release (where your assertion fails), note that it passes if you change the order of your checks (so it also passes the case for shared_ptr<ClassA>
. Hmm, the reason is that in fact, ptr.is
returns true for any shared_ptr
type, such as shared_ptr<int>
!
// This seems to return true in Release, for sol::object of any shared_ptr<> type
bool result = ptr.is<std::shared_ptr<int>>();
@totalgee Exactly, weirdly enough. It is sad that these bugs exist in a nice library.
struct ClassA { virtual ~ClassA() = default;
};
class ClassB { };
int main() { sol::state lua;
do local instance = ClassA.makeShared() assert(call(instance) == "ClassA") end )", [](lua_State*, sol::protected_function_result pfr) { sol::error err = pfr; std::cout << err.what() << std::endl; return pfr; });
}