What steps will reproduce the problem?
1. Compile VirtualLeaf on a Linux machine with g++ 4.7.x
2. The compiler stops in mesh.h in the following lines:
template<class Op> void RandomlyLoopNodes(Op f) {
MyUrand r(shuffled_nodes.size());
random_shuffle(shuffled_nodes.begin(),shuffled_nodes.end(),r);
for (vector<Node *>::const_iterator i=shuffled_nodes.begin();
i!=shuffled_nodes.end();
i++) {
f(*shuffled_nodes[*i]);
}
}
template<class Op> void RandomlyLoopCells(Op f) {
MyUrand r(shuffled_cells.size());
random_shuffle(shuffled_cells.begin(),shuffled_cells.end(),r);
for (vector<Cell *>::const_iterator i=shuffled_cells.begin();
i!=shuffled_cells.end();
i++) {
f(*shuffled_cells[*i]);
}
}
Because of some kind of miracle, the previous compilers had no problems with
this piece of faulty code.
*shuffled_cells[*i] and *shuffled_nodes[*i] are incorrect, because "*i" is of
type "Node" or "Cell", on which we try to call operator[].
The code is not used, so we can safely remove it from the distribution.
Original issue reported on code.google.com by
roelandm...@gmail.comon 27 Mar 2013 at 1:59