[libcxx] r242148 - Move bits from N4258. Mark vector's move-constructor unconditionally noexcept in C++1z
Marshall Clow
mclow.lists at gmail.com
Tue Jul 14 07:46:32 PDT 2015
Author: marshall
Date: Tue Jul 14 09:46:32 2015
New Revision: 242148
URL: http://llvm.org/viewvc/llvm-project?rev=242148&view=rev
Log:
Move bits from N4258. Mark vector's move-constructor unconditionally noexcept in C++1z
Modified:
libcxx/trunk/include/vector
libcxx/trunk/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=242148&r1=242147&r2=242148&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Tue Jul 14 09:46:32 2015
@@ -553,7 +553,11 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x)
+#if _LIBCPP_STD_VER > 14
+ _NOEXCEPT;
+#else
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+#endif
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
@@ -1220,7 +1224,11 @@ vector<_Tp, _Allocator>::vector(const ve
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>::vector(vector&& __x)
+#if _LIBCPP_STD_VER > 14
+ _NOEXCEPT
+#else
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+#endif
: __base(_VSTD::move(__x.__alloc()))
{
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -2195,7 +2203,11 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __v)
+#if _LIBCPP_STD_VER > 14
+ _NOEXCEPT;
+#else
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+#endif
vector(vector&& __v, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __v)
@@ -2785,7 +2797,11 @@ vector<bool, _Allocator>::operator=(cons
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>::vector(vector&& __v)
+#if _LIBCPP_STD_VER > 14
+ _NOEXCEPT
+#else
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+#endif
: __begin_(__v.__begin_),
__size_(__v.__size_),
__cap_alloc_(__v.__cap_alloc_)
Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp?rev=242148&r1=242147&r2=242148&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp Tue Jul 14 09:46:32 2015
@@ -43,7 +43,12 @@ int main()
}
{
typedef std::vector<bool, some_alloc<bool>> C;
+ // In C++17, move constructors for allocators are not allowed to throw
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_move_constructible<C>::value, "");
+#else
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+#endif
}
#endif
}
Modified: libcxx/trunk/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp?rev=242148&r1=242147&r2=242148&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp Tue Jul 14 09:46:32 2015
@@ -44,7 +44,12 @@ int main()
}
{
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+ // In C++17, move constructors for allocators are not allowed to throw
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_move_constructible<C>::value, "");
+#else
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+#endif
}
#endif
}
More information about the cfe-commits
mailing list