Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in overload resolution #36

Open
bluescarni opened this issue Apr 13, 2017 · 0 comments
Open

Possible bug in overload resolution #36

bluescarni opened this issue Apr 13, 2017 · 0 comments

Comments

@bluescarni
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant