[libcxx] r189398 - 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
Marshall Clow
mclow.lists at gmail.com
Tue Aug 27 13:18:59 PDT 2013
Author: marshall
Date: Tue Aug 27 15:18:59 2013
New Revision: 189398
URL: http://llvm.org/viewvc/llvm-project?rev=189398&view=rev
Log:
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
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/locale
libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
libcxx/trunk/www/cxx1y_status.html
Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=189398&r1=189397&r2=189398&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Aug 27 15:18:59 2013
@@ -570,8 +570,10 @@ template <unsigned> struct __static_asse
#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
Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=189398&r1=189397&r2=189398&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Tue Aug 27 15:18:59 2013
@@ -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
Modified: libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp?rev=189398&r1=189397&r2=189398&view=diff
==============================================================================
--- libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp (original)
+++ libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp Tue Aug 27 15:18:59 2013
@@ -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);
Modified: libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp?rev=189398&r1=189397&r2=189398&view=diff
==============================================================================
--- libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp (original)
+++ libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp Tue Aug 27 15:18:59 2013
@@ -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
}
}
Modified: libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp?rev=189398&r1=189397&r2=189398&view=diff
==============================================================================
--- libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp (original)
+++ libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp Tue Aug 27 15:18:59 2013
@@ -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
Modified: libcxx/trunk/www/cxx1y_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1y_status.html?rev=189398&r1=189397&r2=189398&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1y_status.html (original)
+++ libcxx/trunk/www/cxx1y_status.html Tue Aug 27 15:18:59 2013
@@ -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>
More information about the cfe-commits
mailing list