More of N4258 implementation. Mark all of our test_allocators as noexcept constructible. Make the constructors for basic_string noexcept all the time (under C++14). Update tests to reflect the new world order. More to come.
llvm-svn: 238957
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: cbf166a2b928e3e037fba2b1f1bb64e5b6e4c26c
diff --git a/include/string b/include/string
index 840932a..b8cbea3 100644
--- a/include/string
+++ b/include/string
@@ -1321,14 +1321,31 @@
static const size_type npos = -1;
_LIBCPP_INLINE_VISIBILITY basic_string()
+#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
- _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a);
+#else
+ _NOEXCEPT;
+#endif
+
+ _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
+#if _LIBCPP_STD_VER <= 14
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
+#else
+ _NOEXCEPT;
+#endif
+
basic_string(const basic_string& __str);
basic_string(const basic_string& __str, const allocator_type& __a);
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str)
+#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+#else
+ _NOEXCEPT;
+#endif
+
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1926,7 +1943,11 @@
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string()
- _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+#if _LIBCPP_STD_VER <= 14
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+#else
+ _NOEXCEPT
+#endif
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -2070,7 +2091,11 @@
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
+#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+#else
+ _NOEXCEPT
+#endif
: __r_(_VSTD::move(__str.__r_))
{
__str.__zero();