We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Clang caught some unneeded std::moves which inhibit copy elision:
std::move
fs.hpp line 39
inline std::fstream open(const fs::path& filepath, std::ios::openmode mode) { std::error_code ec; auto ret = open(filepath, mode, ec); if (ec) { throw std::system_error{ec, "Open file: " + filepath.string()}; } return std::move(ret); // error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] }
fs.cpp line 13
std::fstream pf::open(const fs::path& filepath, std::ios::openmode mode, std::error_code& ec) { std::fstream ret; auto mask = ret.exceptions() | std::ios::failbit; ret.exceptions(mask); try { ret.open(filepath.string(), mode); } catch (const std::ios::failure& e) { ec = e.code(); } return std::move(ret); // error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] }
In both these cases, the return std::move(ret); should simply be return ret;
return std::move(ret);
return ret;
The text was updated successfully, but these errors were encountered:
Fixed by 6c40d62
Sorry, something went wrong.
No branches or pull requests
Clang caught some unneeded
std::move
s which inhibit copy elision:fs.hpp line 39
fs.cpp line 13
In both these cases, the
return std::move(ret);
should simply bereturn ret;
The text was updated successfully, but these errors were encountered: