gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.
MIT License
1.31k stars 168 forks source link

function without noexcept occur false #150

Closed AndrewAndHelen closed 2 years ago

AndrewAndHelen commented 2 years ago

Hi my machine is: Apple clang version 13.1.6 (clang-1316.0.21.2.3) Target: arm64-apple-darwin21.2.0 Thread model: posix

I use "filesystem.hpp" in my project, but When I use function without noexcept, compiler tell me some errors:

  fs::path p(dest_path);
  std::error_code ec;
  fs::file_status s = fs::status(p, ec);
  bool f = fs::exists(p);

error message is:

[build]   bool f = fs::exists(p);
[build]            ^~~~~~~~~~
[build] /Users/liuweiyu/Documents/s3_client/ghc/filesystem.hpp:4238:17: note: candidate function not viable: no known conversion from 'fs::path' to 'ghc::filesystem::file_status' for 1st argument
[build] GHC_INLINE bool exists(file_status s) noexcept
[build]                 ^
[build] /Users/liuweiyu/Documents/s3_client/ghc/filesystem.hpp:4250:17: note: candidate function not viable: requires 2 arguments, but 1 was provided
[build] GHC_INLINE bool exists(const path& p, std::error_code& ec) noexcept
[build]                 ^
[build] 1 error generated.

Please give me some help, thanks!

AndrewAndHelen commented 2 years ago

ok, I know why I have this problem, because I add -fno-exceptions into my compier options...