-
Notifications
You must be signed in to change notification settings - Fork 89
Description
I am running in a compilation failure on 32bit platforms for the shortest-paths.cxx test. The symptoms are the following:
/home/bluescarni/repos/graph/include/andres/graph/shortest-paths.hxx:1542:22: error: lvalue required as left operand of assignment
distances[v] = infinity;
~~~~~~~~~~~~~^~~~~~~~~~
/home/bluescarni/repos/graph/include/andres/graph/shortest-paths.hxx:1547:19: error: lvalue required as left operand of assignment
distances[vs] = 0;
~~~~~~~~~~~~~~^~~
/home/bluescarni/repos/graph/include/andres/graph/shortest-paths.hxx:1565:45: error: lvalue required as left operand of assignment
distances[it->vertex()] = alternativeDistance;
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~The problem seems to be that, on some 32bit platforms, std::size_t and unsigned are the same type. What happens then is that this call:
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1364
resolves to this function (on 32bit platforms)
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1376
rather than this:
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1448
So when the flow finally gets inside this function:
https://github.com/bjoern-andres/graph/blob/master/include/andres/graph/shortest-paths.hxx#L1516
DISTANCE_ITERATOR is of type UnitEdgeValueIterator, and the line distances[v] = infinity; fails because distances[v] yields a value rather than a reference.
The issue can be reproduced on 32bit build on MSVC, clang and gcc.