Hi,
Yes that is a bug in the default constructor of NaryUnion. Alas, I have no idea yet how to fix it (the point is, this damned thing should not have a default constructor in the first place ;-( ). The reason why the default constructor comes into play is because of the array declaration narr[2] which runs the default constructor on narr[0] and narr[1]. What would make it work is if you first run a call to init() on the array elements narr[.] rather than an assignment operator. Cheers Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Farshid Hassani Bijarbooneh Sent: Thursday, July 11, 2013 6:01 PM To: users@gecode.org Subject: [gecode-users] operator = for NaryUnion Hi, In Gecode 4.1 creating n-ary union of variable ranges and assigning to a NaryUnion causes a segmentation fault, whereas in Gecode 3.7.3 it seems to work: Region myRegion(*this); Iter::Ranges::NaryUnion narr[2]; IntVarRanges* varRange = myRegion.alloc<IntVarRanges>(x.size()); // x is IntVarArray variables of the model for (int r=0; r < x.size(); r++) { varRange[r].init(x[r]); } narr[0] = Iter::Ranges::NaryUnion(myRegion, varRange, x.size()); If we instead create only one NaryUnion then it works fine in Gecode 4.1: Iter::Ranges::NaryUnion uni(myRegion, varRange, x.size()); I also attached a minimal code demonstrating this issue. Do you think if there is something I'm missing here? Cheers, Farshid _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users