G-Node / nix

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

[File] disambiguate bfs::exist constructor #796

Closed gicmo closed 4 years ago

gicmo commented 4 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(<brace-enclosed initializer list>)’ 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()); }
      |                    ^~~~~~

Closes #795

codecov[bot] commented 4 years ago

Codecov Report

Merging #796 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #796   +/-   ##
=======================================
  Coverage   95.34%   95.34%           
=======================================
  Files         197      197           
  Lines       12212    12212           
=======================================
  Hits        11644    11644           
  Misses        568      568
Impacted Files Coverage Δ
src/File.cpp 92.85% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 578ebde...cadd071. Read the comment docs.

achilleas-k commented 4 years ago

Tested locally with boost 1.71 and it works.

EDIT: Want to rebase or do an auto merge commit on GitHub?