mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 18:11:19 +00:00
Use LLVM_EXPLICIT instead of a function pointer as bool.
llvm-svn: 199437
This commit is contained in:
parent
80a38428e5
commit
98d3c101dd
@ -169,12 +169,9 @@ public:
|
||||
getStorage()->~storage_type();
|
||||
}
|
||||
|
||||
typedef void (*unspecified_bool_type)();
|
||||
static void unspecified_bool_true() {}
|
||||
|
||||
/// \brief Return false if there is an error.
|
||||
operator unspecified_bool_type() const {
|
||||
return HasError ? 0 : unspecified_bool_true;
|
||||
LLVM_EXPLICIT operator bool() const {
|
||||
return !HasError;
|
||||
}
|
||||
|
||||
reference get() { return *getStorage(); }
|
||||
|
@ -20,7 +20,9 @@ ErrorOr<int> t2() { return errc::invalid_argument; }
|
||||
|
||||
TEST(ErrorOr, SimpleValue) {
|
||||
ErrorOr<int> a = t1();
|
||||
EXPECT_TRUE(a);
|
||||
// FIXME: This is probably a bug in gtest. EXPECT_TRUE should expand to
|
||||
// include the !! to make it friendly to explicit bool operators.
|
||||
EXPECT_TRUE(!!a);
|
||||
EXPECT_EQ(1, *a);
|
||||
|
||||
ErrorOr<int> b = a;
|
||||
|
Loading…
x
Reference in New Issue
Block a user