Currently, I try to incorporate lemon library in our project. Most developers are on Windows, they compile with MSVC, but I am in charge (for this part) to compile with gcc and clang.
I came across an error with clang that gcc does not reproduce and I managed to reduce the code:
#include <lemon/dfs.h>
int main() {
lemon::ListDigraph g{};
lemon::ListDigraph::Node node = g.nodeFromId(42);
lemon::Dfs<lemon::ListDigraph> dfs{g};
lemon::SimplePath<lemon::ListDigraph> path = dfs.path(node);
return 0;
}
With gcc, no errors.
/usr/bin/g++-5 -std=c++11 -Wall -O3 -I${SRC_ROOT}/external/lemon/latest -I${BIN_ROOT}/lemon -o ${TMP_ROOT}/core/src/core.cpp.o -c ${SRC_ROOT}/core/src/core.cpp
But with clang:
/usr/bin/clang++-3.7 -std=c++11 -Wall -stdlib=libc++ -O3 -I${SRC_ROOT}/external/lemon/latest -I${BIN_ROOT}/lemon -o ${TMP_ROOT}/core/src/core.cpp.o -c ${SRC_ROOT}/core/src/core.cpp
In file included from ${SRC_ROOT}/core/src/core.cpp:1:
In file included from ${SRC_ROOT}/external/lemon/latest/lemon/dfs.h:31:
${SRC_ROOT}/external/lemon/latest/lemon/path.h:408:23: error: no viable
conversion from 'typename PredMapPath<ListDigraph, NodeMap<Arc> >::RevArcIt' to
'lemon::ListDigraphBase::Arc'
data[index] = it;;
^~
Notes:
SRC_ROOT
,BIN_ROOT
,TMP_ROOT
are replaced for readability- the snippet source code won't work, but should compile (I will correct the real big code)
- I really need the c++11 features for the real source code.
gcc
5clang
3.7lemon
1.3.1
Questions :
- Did I forget to clang a flag?
- Does lemon is fully compatible with clang?
- How to solve this error?
lemon/path.h
compiles without warning.operator Arc ()
.-std=c++11
neither-stdlib=libc++
and it works without warnings (with modifying original code not to use initializer lists).