G-Node / nix

Neuroscience information exchange format
https://readthedocs.org/projects/nixio/
Other
68 stars 36 forks source link

[File] disambiguate bfs::exist constructor #833

Closed jgrewe closed 3 years ago

jgrewe commented 3 years ago

Explicitly instantiate a boost::filesystem::path object to avoid any ambiguity via implicit type conversion; as seems to be happen with boost 1.71:

/src/src/File.cpp: In static member function ‘static nix::File nix::File::open(const string&, nix::FileMode, const string&, nix::Compression, nix::OpenFlags)’: /src/src/File.cpp:29:63: error: call of overloaded ‘exists()’ is ambiguous 29 | if (mode == nix::FileMode::ReadOnly && !bfs::exists({name})) { | ^ In file included from /usr/include/boost/filesystem.hpp:17, from /src/src/File.cpp:18: /usr/include/boost/filesystem/operations.hpp:463:8: note: candidate: ‘bool boost::filesystem::exists(const boost::filesystem::path&)’ 463 | bool exists(const path& p) {return exists(detail::status(p));} | ^~ In file included from /usr/include/boost/filesystem.hpp:17, from /src/src/File.cpp:18: /usr/include/boost/filesystem/operations.hpp:874:20: note: candidate: ‘bool boost::filesystem::exists(const boost::filesystem::directory_entry&)’ 874 | inline bool exists (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::exists(e.status()); } | ^~