diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-04 00:32:24 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-04 00:32:24 +0000 |
commit | 32a15547da68aeca2b9af9c13d35ad982bebe408 (patch) | |
tree | 3b8a7babafc416a5cd1e28d615794439308bfb5e /llvm | |
parent | 962fbc42b5579681734f171f0f2ca84443499d57 (diff) | |
download | bcm5719-llvm-32a15547da68aeca2b9af9c13d35ad982bebe408.tar.gz bcm5719-llvm-32a15547da68aeca2b9af9c13d35ad982bebe408.zip |
Support/SystemError: Make error_category and error_code auto-bool-conversion-safe.
llvm-svn: 120869
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/Support/system_error.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/include/llvm/Support/system_error.h b/llvm/include/llvm/Support/system_error.h index 9d4a8b721e3..40f5b3cd7ff 100644 --- a/llvm/include/llvm/Support/system_error.h +++ b/llvm/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) { |