1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <map> 11 12 // ~map() // implied noexcept; 13 14 #include <map> 15 #include <cassert> 16 17 #include "MoveOnly.h" 18 #include "test_allocator.h" 19 20 #if __has_feature(cxx_noexcept) 21 22 template <class T> 23 struct some_comp 24 { 25 typedef T value_type; 26 ~some_comp() noexcept(false); 27 }; 28 29 #endif 30 31 int main() 32 { 33 #if __has_feature(cxx_noexcept) 34 typedef std::pair<const MoveOnly, MoveOnly> V; 35 { 36 typedef std::map<MoveOnly, MoveOnly> C; 37 static_assert(std::is_nothrow_destructible<C>::value, ""); 38 } 39 { 40 typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C; 41 static_assert(std::is_nothrow_destructible<C>::value, ""); 42 } 43 { 44 typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C; 45 static_assert(std::is_nothrow_destructible<C>::value, ""); 46 } 47 { 48 typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C; 49 static_assert(!std::is_nothrow_destructible<C>::value, ""); 50 } 51 #endif 52 } 53