[llvm-commits] [llvm] r120869 - /llvm/trunk/include/llvm/Support/system_error.h
Michael J. Spencer
bigcheesegs at gmail.com
Fri Dec 3 16:32:24 PST 2010
Author: mspencer
Date: Fri Dec 3 18:32:24 2010
New Revision: 120869
URL: http://llvm.org/viewvc/llvm-project?rev=120869&view=rev
Log:
Support/SystemError: Make error_category and error_code auto-bool-conversion-safe.
Modified:
llvm/trunk/include/llvm/Support/system_error.h
Modified: llvm/trunk/include/llvm/Support/system_error.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/system_error.h?rev=120869&r1=120868&r2=120869&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/system_error.h (original)
+++ llvm/trunk/include/llvm/Support/system_error.h Fri Dec 3 18:32:24 2010
@@ -708,8 +708,12 @@
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 @@
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) {
More information about the llvm-commits
mailing list