Don't use std::errc.
As noted on Errc.h:
// * std::errc is just marked with is_error_condition_enum. This means that
// common patters like AnErrorCode == errc::no_such_file_or_directory take
// 4 virtual calls instead of two comparisons.
And on some libstdc++ those virtual functions conclude that
------------------------
int main() {
std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory);
return foo == std::errc::no_such_file_or_directory;
}
-------------------------
should exit with 0.
llvm-svn: 239683
diff --git a/llvm/unittests/Support/ErrorOrTest.cpp b/llvm/unittests/Support/ErrorOrTest.cpp
index 5e8d442..73d0e3f 100644
--- a/llvm/unittests/Support/ErrorOrTest.cpp
+++ b/llvm/unittests/Support/ErrorOrTest.cpp
@@ -67,8 +67,8 @@
}
TEST(ErrorOr, Comparison) {
- ErrorOr<int> x(std::errc::no_such_file_or_directory);
- EXPECT_EQ(x, std::errc::no_such_file_or_directory);
+ ErrorOr<int> x(errc::no_such_file_or_directory);
+ EXPECT_EQ(x, errc::no_such_file_or_directory);
}
// ErrorOr<int*> x(nullptr);