[libc++] Enable `explicit` conversion operators, even in C++03 mode.
C++03 didn't support `explicit` conversion operators;
but Clang's C++03 mode does, as an extension, so we can use it.
This lets us make the conversion explicit in `std::function` (even in '03),
and remove some silly metaprogramming in `std::basic_ios`.
Drive-by improvements to the tests for these operators, in addition
to making sure all these tests also run in `c++03` mode.
Differential Revision: https://reviews.llvm.org/D104682
NOKEYCHECK=True
GitOrigin-RevId: 317e92a3e82f88f111e04132195d9daa6b97f1ab
diff --git a/include/exception b/include/exception
index 3405a42..353ebf7 100644
--- a/include/exception
+++ b/include/exception
@@ -151,7 +151,7 @@
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
~exception_ptr() _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY explicit operator bool() const _NOEXCEPT
{return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY
@@ -205,7 +205,7 @@
exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT;
exception_ptr& operator=(nullptr_t) _NOEXCEPT;
~exception_ptr() _NOEXCEPT;
- _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT;
+ explicit operator bool() const _NOEXCEPT;
};
_LIBCPP_FUNC_VIS