// { dg-do compile { target c++11 } } // LWG 3778. vector missing exception specifications #include #include using V = std::vector; static_assert(std::is_nothrow_default_constructible::value, "nothrow default constructible with std::allocator"); static_assert(std::is_nothrow_constructible::value, "nothrow constructible with allocator argument"); static_assert(std::is_nothrow_move_constructible::value, "unconditionally nothrow move constructible"); static_assert(std::is_nothrow_move_assignable::value, "nothrow move assignment with std::allocator"); static_assert(std::__is_nothrow_swappable::value, "nothrow swap with std::allocator"); template struct Allocator : __gnu_test::SimpleAllocator { Allocator() noexcept(false) { } template Allocator(const Allocator&) { } }; using V2 = std::vector>; static_assert(std::is_default_constructible::value, "default constructible with Allocator"); static_assert(std::is_nothrow_constructible::value, "nothrow constructible with allocator argument"); static_assert(! std::is_nothrow_default_constructible::value, "but not nothrow default constructible with Allocator"); static_assert(std::is_nothrow_move_constructible::value, "also checked by ./noexcept_move_construct.cc"); static_assert(std::__is_nothrow_swappable::value, "nothrow swap with std::allocator"); template struct PropAllocator : __gnu_test::SimpleAllocator { PropAllocator() noexcept { } template PropAllocator(const PropAllocator&) { } using is_always_equal = POCMA; using propagate_on_container_move_assignment = IAE; }; using V3 = std::vector>; static_assert(std::is_nothrow_move_constructible::value, "unconditionally nothrow move constructible"); static_assert(std::is_nothrow_constructible::value, "nothrow constructible with allocator argument"); static_assert(! std::is_nothrow_move_assignable::value, "throwing move assignment with !(propagating || equal) alloc"); #ifdef _GLIBCXX_RELEASE // We strengthen std::vector::swap to be always noexcept. static_assert(std::__is_nothrow_swappable::value, "nothrow swap even with !(propagating || equal) alloc"); #endif using V4 = std::vector>; static_assert(std::is_nothrow_constructible::value, "nothrow constructible with allocator argument"); static_assert(std::is_nothrow_move_constructible::value, "unconditionally nothrow move constructible"); static_assert(std::is_nothrow_move_assignable::value, "nothrow move assignment with propagating alloc"); static_assert(std::__is_nothrow_swappable::value, "nothrow swap with always-equal alloc"); using V5 = std::vector>; static_assert(std::is_nothrow_constructible::value, "nothrow constructible with allocator argument"); static_assert(std::is_nothrow_move_constructible::value, "unconditionally nothrow move constructible"); static_assert(std::is_nothrow_move_assignable::value, "nothrow move assignment with always-equal alloc"); static_assert(std::__is_nothrow_swappable::value, "nothrow swap with always-equal alloc");