mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
[Support] Fix ErrorOr equality operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
56409de6c4
commit
b86942cca4
@ -281,8 +281,8 @@ template <class T, class E>
|
||||
typename std::enable_if<std::is_error_code_enum<E>::value ||
|
||||
std::is_error_condition_enum<E>::value,
|
||||
bool>::type
|
||||
operator==(ErrorOr<T> &Err, E Code) {
|
||||
return std::error_code(Err) == Code;
|
||||
operator==(const ErrorOr<T> &Err, E Code) {
|
||||
return Err.getError() == Code;
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
|
@ -66,6 +66,11 @@ TEST(ErrorOr, Covariant) {
|
||||
ErrorOr<std::unique_ptr<int>> b4(b3);
|
||||
}
|
||||
|
||||
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(nullptr);
|
||||
// ErrorOr<std::unique_ptr<int>> y = x; // invalid conversion
|
||||
static_assert(
|
||||
|
Loading…
x
Reference in New Issue
Block a user