brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 417f449 Raw
50 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <deque>10 11// deque& operator=(deque&& c)12//     noexcept(13//          allocator_type::propagate_on_container_move_assignment::value &&14//          is_nothrow_move_assignable<allocator_type>::value);15 16// This tests a conforming extension17 18// UNSUPPORTED: c++0319 20#include <deque>21 22#include "test_macros.h"23#include "MoveOnly.h"24#include "test_allocator.h"25 26template <class T>27struct always_equal_alloc {28  using value_type = T;29  always_equal_alloc(const always_equal_alloc&);30  void allocate(std::size_t);31};32 33template <class T>34struct not_always_equal_alloc {35  int i;36  using value_type = T;37  not_always_equal_alloc(const not_always_equal_alloc&);38  void allocate(std::size_t);39};40 41static_assert(std::is_nothrow_move_assignable<std::deque<MoveOnly>>::value, "");42static_assert(!std::is_nothrow_move_assignable<std::deque<MoveOnly, test_allocator<MoveOnly>>>::value, "");43#if TEST_STD_VER >= 1744static_assert(std::is_nothrow_move_assignable<std::deque<MoveOnly, always_equal_alloc<MoveOnly>>>::value, "");45#endif46static_assert(!std::is_nothrow_move_assignable<std::deque<MoveOnly, not_always_equal_alloc<MoveOnly>>>::value, "");47#if defined(_LIBCPP_VERSION)48static_assert(std::is_nothrow_move_assignable<std::deque<MoveOnly, other_allocator<MoveOnly>>>::value, "");49#endif // _LIBCPP_VERSION50