diff options
| author | Eric Fiselier <eric@efcs.ca> | 2017-01-02 20:15:33 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2017-01-02 20:15:33 +0000 |
| commit | e9735f17e04bd5cd4cf232a733edc1d0652b9753 (patch) | |
| tree | e1925d9eae48f5be6c6e0555958520fcab6b10a3 /libcxx/include/ios | |
| parent | aa0ec1e99207305f02f5a323221856422e81ca4c (diff) | |
| download | bcm5719-llvm-e9735f17e04bd5cd4cf232a733edc1d0652b9753.tar.gz bcm5719-llvm-e9735f17e04bd5cd4cf232a733edc1d0652b9753.zip | |
Rework fix for PR19460 - Use explicit bool as an extension instead.
In the previous fix I used a PMF type as a semi-safe bool type in C++03.
However immediately after committing I realized clang offered explicit
conversion operators as an extension. This patch removes the old fix and
enables _LIBCPP_EXPLICIT using __has_extension instead.
This change also affects the following other classes, which have
'_LIBCPP_EXPLICIT operator bool()'.
* shared_ptr
* unique_ptr
* error_condition
* basic_ios
* function (already C++11 only)
* istream::sentry
* experimental::string_view.
In all of the above cases I believe it is safe to enable the extension, except
in the experimental::string_view case. There seem to be some Clang bugs
affecting the experimental::string_view conversion to std::basic_string. To
work around that I manually disabled _LIBCPP_EXPLICIT in that case.
llvm-svn: 290831
Diffstat (limited to 'libcxx/include/ios')
| -rw-r--r-- | libcxx/include/ios | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/libcxx/include/ios b/libcxx/include/ios index fb8f88dddab..ea83822ac16 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -572,13 +572,6 @@ 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_TYPE_VIS_ONLY basic_ios : public ios_base @@ -592,18 +585,8 @@ 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();} |

