immer: Segmentation fault with recursive types
I found what appears to be a memory corruption issue with recursive types using box
. Below is a minimal reproducer which seg-faults on my machine. I am on clang, MacOS 10.14, and -std=c++14
.
#include "immer/vector.hpp"
#include "immer/box.hpp"
//=============================================================================
struct my_type
{
using container_t = immer::vector<immer::box<my_type>>;
using func_t = std::function<int(int)>;
int ival;
double dval;
func_t func;
container_t children;
};
//=============================================================================
int main()
{
my_type::container_t items = {my_type()};
return 0;
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (22 by maintainers)
Commits related to this issue
- Attempt to reproduce issue #74 Can't reproduce. I think I need a Mac for that. Shall try in Berlin in a few days... — committed to arximboldi/immer by arximboldi 5 years ago
It seems like we fixed it. Thanks @jzrake for the work. Curious about what you build with the library! Good luck!
Thanks for the update! I can confirm the undefined warnings with champ are gone now. Looking forward to a fix for whatever’s going on with the Mac.
Damn. Ok let’s see if I find something next week. Have a nice weekend!