Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eigen Types + variant + holds_alternative<> + immer::flex_vector segfault in opt builds. #228

Open
asa opened this issue Sep 1, 2022 · 1 comment

Comments

@asa
Copy link
Contributor

asa commented Sep 1, 2022

Using types like Eigen::Vector3d in structs in variants in flex vectors cause a crash in immer when I

a variant like:

struct a_t{
        Eigen::Vector3d position;
};
struct b_t{
        double x;
};
using nifty_variant = std::variant<a_t, b_t>;

and I try and filter out some of these structs with:


template<typename T>
inline auto filter(const immer::flex_vector<nifty_variant>& buf) {
    immer::flex_vector<T> out{};
    immer::for_each(buf.begin(), buf.end(), [&out](auto a) {
        if (std::holds_alternative<T>(a)) {
            out = move(out).push_back(std::get<T>(a));
        }
    });
    return out;
}

I get segfaults in opt builds, but not in debug builds like:

#0  0x0000000000476478 in immer::detail::rbts::rrbtree< nifty_variant, immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap, 1024ul>, immer::refcount_policy, immer::spinlock_policy, immer::no_transience_policy, false, true>, 5u, 1u>::push_back_mut(immer::no_transience_policy::apply<immer::free_list_heap_policy<immer::cpp_heap, 1024ul> >::type::edit, nifty_variant) ()
@arximboldi
Copy link
Owner

Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants