mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2024-11-30 07:10:33 +00:00
LWG issues 2174/5/6 - mark wstring_convert::converted as noexcept, and make (some of) the constructors for wstring_convert and wbuffer_convert as explicit. Add configuration macro _LIBCPP_EXPLICIT_AFTER_CXX11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189398 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5f36c68cb0
commit
83179a788f
@ -570,8 +570,10 @@ template <unsigned> struct __static_assert_check {};
|
||||
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
#define _LIBCPP_EXPLICIT_AFTER_CXX11
|
||||
#else
|
||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
|
||||
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
@ -93,10 +93,12 @@ public:
|
||||
typedef typename Codecvt::state_type state_type;
|
||||
typedef typename wide_string::traits_type::int_type int_type;
|
||||
|
||||
wstring_convert(Codecvt* pcvt = new Codecvt);
|
||||
explicit wstring_convert(Codecvt* pcvt = new Codecvt); // explicit in C++14
|
||||
wstring_convert(Codecvt* pcvt, state_type state);
|
||||
wstring_convert(const byte_string& byte_err,
|
||||
explicit wstring_convert(const byte_string& byte_err, // explicit in C++14
|
||||
const wide_string& wide_err = wide_string());
|
||||
wstring_convert(const wstring_convert&) = delete; // C++14
|
||||
wstring_convert & operator=(const wstring_convert &) = delete; // C++14
|
||||
~wstring_convert();
|
||||
|
||||
wide_string from_bytes(char byte);
|
||||
@ -109,7 +111,7 @@ public:
|
||||
byte_string to_bytes(const wide_string& wstr);
|
||||
byte_string to_bytes(const Elem* first, const Elem* last);
|
||||
|
||||
size_t converted() const;
|
||||
size_t converted() const; // noexcept in C++14
|
||||
state_type state() const;
|
||||
};
|
||||
|
||||
@ -120,9 +122,12 @@ class wbuffer_convert
|
||||
public:
|
||||
typedef typename Tr::state_type state_type;
|
||||
|
||||
wbuffer_convert(streambuf* bytebuf = 0, Codecvt* pcvt = new Codecvt,
|
||||
state_type state = state_type());
|
||||
|
||||
explicit wbuffer_convert(streambuf* bytebuf = 0, Codecvt* pcvt = new Codecvt,
|
||||
state_type state = state_type()); // explicit in C++14
|
||||
wbuffer_convert(const wbuffer_convert&) = delete; // C++14
|
||||
wbuffer_convert & operator=(const wbuffer_convert &) = delete; // C++14
|
||||
~wbuffer_convert(); // C++14
|
||||
|
||||
streambuf* rdbuf() const;
|
||||
streambuf* rdbuf(streambuf* bytebuf);
|
||||
|
||||
@ -4009,9 +4014,9 @@ private:
|
||||
wstring_convert(const wstring_convert& __wc);
|
||||
wstring_convert& operator=(const wstring_convert& __wc);
|
||||
public:
|
||||
wstring_convert(_Codecvt* __pcvt = new _Codecvt);
|
||||
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
|
||||
wstring_convert(_Codecvt* __pcvt, state_type __state);
|
||||
wstring_convert(const byte_string& __byte_err,
|
||||
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err,
|
||||
const wide_string& __wide_err = wide_string());
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
wstring_convert(wstring_convert&& __wc);
|
||||
@ -4041,7 +4046,7 @@ public:
|
||||
byte_string to_bytes(const _Elem* __first, const _Elem* __last);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
size_t converted() const {return __cvtcount_;}
|
||||
size_t converted() const _NOEXCEPT {return __cvtcount_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
state_type state() const {return __cvtstate_;}
|
||||
};
|
||||
@ -4275,8 +4280,8 @@ private:
|
||||
wbuffer_convert(const wbuffer_convert&);
|
||||
wbuffer_convert& operator=(const wbuffer_convert&);
|
||||
public:
|
||||
wbuffer_convert(streambuf* __bytebuf = 0, _Codecvt* __pcvt = new _Codecvt,
|
||||
state_type __state = state_type());
|
||||
_LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
|
||||
_Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
|
||||
~wbuffer_convert();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -37,6 +37,10 @@ void operator delete(void* p) throw()
|
||||
int main()
|
||||
{
|
||||
typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > B;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(!std::is_convertible<std::streambuf*, B>::value, "");
|
||||
static_assert( std::is_constructible<B, std::streambuf*>::value, "");
|
||||
#endif
|
||||
{
|
||||
B b;
|
||||
assert(b.rdbuf() == nullptr);
|
||||
|
@ -30,5 +30,9 @@ int main()
|
||||
typedef std::wstring_convert<Codecvt> Myconv;
|
||||
Myconv myconv(new Codecvt);
|
||||
assert(myconv.converted() == 0);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(!std::is_convertible<Codecvt*, Myconv>::value, "");
|
||||
static_assert( std::is_constructible<Myconv, Codecvt*>::value, "");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,10 @@ int main()
|
||||
{
|
||||
typedef std::codecvt_utf8<wchar_t> Codecvt;
|
||||
typedef std::wstring_convert<Codecvt> Myconv;
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
static_assert(!std::is_convertible<std::string, Myconv>::value, "");
|
||||
static_assert( std::is_constructible<Myconv, std::string>::value, "");
|
||||
#endif
|
||||
{
|
||||
Myconv myconv;
|
||||
try
|
||||
|
@ -158,9 +158,9 @@
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2138">2138</a></td><td>atomic_flag::clear ordering constraints</td><td>Bristol</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2140">2140</a></td><td>notify_all_at_thread_exit synchronization</td><td>Bristol</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2144">2144</a></td><td>Missing noexcept specification in type_index</td><td>Bristol</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2174">2174</a></td><td>wstring_convert::converted() should be noexcept</td><td>Bristol</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2175">2175</a></td><td>string_convert and wbuffer_convert validity</td><td>Bristol</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2176">2176</a></td><td>Special members for wstring_convert and wbuffer_convert</td><td>Bristol</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2174">2174</a></td><td>wstring_convert::converted() should be noexcept</td><td>Bristol</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2175">2175</a></td><td>string_convert and wbuffer_convert validity</td><td>Bristol</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2176">2176</a></td><td>Special members for wstring_convert and wbuffer_convert</td><td>Bristol</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2177">2177</a></td><td>Requirements on Copy/MoveInsertable</td><td>Bristol</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2185">2185</a></td><td>Missing throws clause for future/shared_future::wait_for/wait_until</td><td>Bristol</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2187">2187</a></td><td>vector<bool> is missing emplace and emplace_back member functions</td><td>Bristol</td><td>Complete</td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user