diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-08-01 11:52:21 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-08-01 11:52:21 +0300 |
commit | e2434aa9d42d50651ed9685b5125f58262366081 (patch) | |
tree | 4ea28d1014d83bf36adf74cd9cf9b8b4029d7bc7 /include/llfio/v2.0/status_code.hpp | |
parent | 964d174c1c44d4810789b198bbf07271cebbe8c8 (diff) |
Add preliminary symlink_handle implementation for POSIX.
Diffstat (limited to 'include/llfio/v2.0/status_code.hpp')
-rw-r--r-- | include/llfio/v2.0/status_code.hpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/include/llfio/v2.0/status_code.hpp b/include/llfio/v2.0/status_code.hpp index 5c240316..79edcde4 100644 --- a/include/llfio/v2.0/status_code.hpp +++ b/include/llfio/v2.0/status_code.hpp @@ -451,25 +451,53 @@ OUTCOME_TEMPLATE(class ErrorCondEnum) OUTCOME_TREQUIRES(OUTCOME_TPRED(std::is_error_condition_enum<ErrorCondEnum>::value)) inline bool operator==(const error_info &a, const ErrorCondEnum &b) { - return make_error_code(a) == std::error_condition(b); + auto _a = make_error_code(a); + auto _b = std::error_condition(b); +#ifndef _WIN32 + // Looks like libstdc++ doesn't map system category to generic category, which is a bug + if(_a.category() == std::system_category() && _b.category() == std::generic_category() && _a.value() == static_cast<int>(b)) + return true; +#endif + return _a == _b; } OUTCOME_TEMPLATE(class ErrorCondEnum) OUTCOME_TREQUIRES(OUTCOME_TPRED(std::is_error_condition_enum<ErrorCondEnum>::value)) inline bool operator==(const ErrorCondEnum &a, const error_info &b) { - return std::error_condition(a) == make_error_code(b); + auto _a = std::error_condition(a); + auto _b = make_error_code(b); +#ifndef _WIN32 + // Looks like libstdc++ doesn't map system category to generic category, which is a bug + if(_a.category() == std::generic_category() && _b.category() == std::system_category() && _b.value() == static_cast<int>(a)) + return true; +#endif + return _a == _b; } OUTCOME_TEMPLATE(class ErrorCondEnum) OUTCOME_TREQUIRES(OUTCOME_TPRED(std::is_error_condition_enum<ErrorCondEnum>::value)) inline bool operator!=(const error_info &a, const ErrorCondEnum &b) { - return make_error_code(a) != std::error_condition(b); + auto _a = make_error_code(a); + auto _b = std::error_condition(b); +#ifndef _WIN32 + // Looks like libstdc++ doesn't map system category to generic category, which is a bug + if(_a.category() == std::system_category() && _b.category() == std::generic_category() && _a.value() == static_cast<int>(b)) + return false; +#endif + return _a != _b; } OUTCOME_TEMPLATE(class ErrorCondEnum) OUTCOME_TREQUIRES(OUTCOME_TPRED(std::is_error_condition_enum<ErrorCondEnum>::value)) inline bool operator!=(const ErrorCondEnum &a, const error_info &b) { - return std::error_condition(a) != make_error_code(b); + auto _a = std::error_condition(a); + auto _b = make_error_code(b); +#ifndef _WIN32 + // Looks like libstdc++ doesn't map system category to generic category, which is a bug + if(_a.category() == std::generic_category() && _b.category() == std::system_category() && _b.value() == static_cast<int>(a)) + return false; +#endif + return _a != _b; } #ifndef NDEBUG // Is trivial in all ways, except default constructibility |