Index: /stable/0.3/Couenne/src/expression/operators/exprGroup.cpp
===================================================================
--- /stable/0.3/Couenne/src/expression/operators/exprGroup.cpp (revision 319)
+++ /stable/0.3/Couenne/src/expression/operators/exprGroup.cpp (revision 320)
@@ -342,6 +342,11 @@
x_occur -> first = w;
else {
- if ((w_occur -> second += x_occur -> second) == 0.) // add coefficients
+ if ((w_occur -> second += x_occur -> second) == 0.) { // add coefficients
lcoeff_.erase (w_occur); // if they cancel out, delete w as well
+
+ // under Microsoft, x_occur may have been invalidated by removing w_occur from lcoeff_, so we search for it again
+ for( x_occur = lcoeff_.begin (); x_occur -> first -> Index () != xind; ++x_occur )
+ assert(x_occur != lcoeff_ .end ()); // it was found before, so it should be still found
+ }
lcoeff_.erase (x_occur); // delete entry of x
}