summaryrefslogtreecommitdiff
path: root/include/llvm/Support/system_error.h
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-04 00:32:24 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-04 00:32:24 +0000
commitda3aaffcbb202ac492e7643fc0b191eca1931ab3 (patch)
tree7b961d96dc3e99265d1b6950c7d59762f9d5d3f3 /include/llvm/Support/system_error.h
parent4958466f9f93664780ab094ec8bd403e34c39ee3 (diff)
downloadllvm-da3aaffcbb202ac492e7643fc0b191eca1931ab3.tar.gz
llvm-da3aaffcbb202ac492e7643fc0b191eca1931ab3.tar.bz2
llvm-da3aaffcbb202ac492e7643fc0b191eca1931ab3.tar.xz
Support/SystemError: Make error_category and error_code auto-bool-conversion-safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/system_error.h')
-rw-r--r--include/llvm/Support/system_error.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/llvm/Support/system_error.h b/include/llvm/Support/system_error.h
index 9d4a8b721e..40f5b3cd7f 100644
--- a/include/llvm/Support/system_error.h
+++ b/include/llvm/Support/system_error.h
@@ -708,8 +708,12 @@ public:
const error_category& category() const {return *_cat_;}
std::string message() const;
- // explicit
- operator bool() const {return _val_ != 0;}
+ typedef void (*unspecified_bool_type)();
+ static void unspecified_bool_true() {}
+
+ operator unspecified_bool_type() const { // true if error
+ return _val_ == 0 ? 0 : unspecified_bool_true;
+ }
};
inline error_condition make_error_condition(errc _e) {
@@ -767,8 +771,12 @@ public:
std::string message() const;
- // explicit
- operator bool() const {return _val_ != 0;}
+ typedef void (*unspecified_bool_type)();
+ static void unspecified_bool_true() {}
+
+ operator unspecified_bool_type() const { // true if error
+ return _val_ == 0 ? 0 : unspecified_bool_true;
+ }
};
inline error_code make_error_code(errc _e) {