STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits.
Make move_assign_noexcept.pass.cpp tests more portable. Note that the relevant wording here was modified by C++17 N4258 "Cleaning-up noexcept in the Library (Rev 3)", which MSVC has implemented exactly. You may wish to modify these tests to have 14/17 codepaths. I'm testing our STL as C++17. First, this was static_asserting that the ordered/unordered associative containers, when templated on other_allocator, satisfy is_nothrow_move_assignable. However, that isn't guaranteed by N4594, where the move assigns are depicted as inspecting is_always_equal (and the Compare/Hash/Pred). other_allocator is stateful, and allocator_traits correctly reports is_always_equal as false. Therefore, these static_asserts should be marked as libc++ specific. Second, this was static_asserting is_nothrow_move_assignable for vector<bool> (both plain and other_allocator). However, vector<bool>'s move assign isn't depicted with any amount of noexcept in the Working Paper, so these static_asserts are non-portable. Third, deque/forward_list/list have move assigns in N4594 that are depicted as inspecting is_always_equal. The tests here were static_asserting is_nothrow_move_assignable for other_allocator, but (again) that's stateful, so is_always_equal is false. Finally, the deque/forward_list/list tests were static_asserting !is_nothrow_move_assignable for some_alloc, which is stateless but with a potentially-throwing copy ctor. This is contrary to N4594, which says "hey, your some_alloc is stateless, so is_always_equal is true, so these containers are nothrow-move-assignable, because you're not allowed to actually emit exceptions from allocator copies/moves". I'm just marking these as LIBCPP_STATIC_ASSERT, but (like the noexcept dtor tests) I believe you actually have a product bug here, at least in C++17 mode. Random aside: these some_alloc classes are bogus, because they aren't rebind-constructible, nor do they have equality/inequality. MSVC happens to accept this, for now. http://reviews.llvm.org/D21718 Files: test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
Index: test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp +++ test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp @@ -56,7 +56,7 @@ { typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C; Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp @@ -56,7 +56,7 @@ { typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C; Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp @@ -56,7 +56,7 @@ { typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C; Index: test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp +++ test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp @@ -56,7 +56,7 @@ { typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C; Index: test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp +++ test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp @@ -60,28 +60,28 @@ { { typedef std::vector<bool> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::vector<bool, test_allocator<bool>> C; static_assert(!std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::vector<bool, other_allocator<bool>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::vector<bool, some_alloc<bool>> C; #if TEST_STD_VER > 14 - static_assert( std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable<C>::value, ""); #else static_assert(!std::is_nothrow_move_assignable<C>::value, ""); #endif } #if TEST_STD_VER > 14 { // POCMA false, is_always_equal true typedef std::vector<bool, some_alloc2<bool>> C; - static_assert( std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable<C>::value, ""); } { // POCMA false, is_always_equal false typedef std::vector<bool, some_alloc3<bool>> C; Index: test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp +++ test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp @@ -43,10 +43,10 @@ } { typedef std::list<MoveOnly, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::list<MoveOnly, some_alloc<MoveOnly>> C; - static_assert(!std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable<C>::value, ""); } } Index: test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp +++ test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp @@ -43,10 +43,10 @@ } { typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C; - static_assert(!std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable<C>::value, ""); } } Index: test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp +++ test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp @@ -43,10 +43,10 @@ } { typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C; - static_assert(!std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable<C>::value, ""); } } Index: test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp +++ test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp @@ -45,7 +45,7 @@ } { typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::set<MoveOnly, some_comp<MoveOnly>> C; Index: test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp +++ test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp @@ -45,7 +45,7 @@ } { typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C; Index: test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp +++ test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp @@ -46,7 +46,7 @@ } { typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C; Index: test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp +++ test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp @@ -46,7 +46,7 @@ } { typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, ""); } { typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits