diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-01-13 18:03:46 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-01-13 18:03:46 +0000 |
commit | c8bd38a15da6cdf9aab68c0ec00efc825aca85ed (patch) | |
tree | 5f4992dec216ead8d05dee5cd6690d4953dced54 /libcxx/include/ios | |
parent | 7f329becb715bfc4ba66ad3ff278be0cdf163404 (diff) | |
download | bcm5719-llvm-c8bd38a15da6cdf9aab68c0ec00efc825aca85ed.tar.gz bcm5719-llvm-c8bd38a15da6cdf9aab68c0ec00efc825aca85ed.zip |
Revert "Rework fix for PR19460 - Use explicit bool as an extension instead."
This reverts commit 3a1b90a866b6d5d62a5f37fbfb3a1ee36cc70dd1.
llvm-svn: 291921
Diffstat (limited to 'libcxx/include/ios')
-rw-r--r-- | libcxx/include/ios | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libcxx/include/ios b/libcxx/include/ios index efee39fb533..b05ee4c785a 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -572,6 +572,13 @@ ios_base::exceptions(iostate __iostate) clear(__rdstate_); } +#if defined(_LIBCPP_CXX03_LANG) +struct _LIBCPP_TYPE_VIS_ONLY __cxx03_bool { + typedef void (__cxx03_bool::*__bool_type)(); + void __true_value() {} +}; +#endif + template <class _CharT, class _Traits> class _LIBCPP_TEMPLATE_VIS basic_ios : public ios_base @@ -585,8 +592,18 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + // __true_value will generate undefined references when linking unless + // we give it internal linkage. + +#if defined(_LIBCPP_CXX03_LANG) + _LIBCPP_ALWAYS_INLINE + operator __cxx03_bool::__bool_type() const { + return !fail() ? &__cxx03_bool::__true_value : nullptr; + } +#else _LIBCPP_ALWAYS_INLINE _LIBCPP_EXPLICIT operator bool() const {return !fail();} +#endif _LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();} _LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();} |