15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier
95a83710eSEric Fiselier // <deque>
105a83710eSEric Fiselier
115a83710eSEric Fiselier // deque& operator=(deque&& c)
125a83710eSEric Fiselier // noexcept(
135a83710eSEric Fiselier // allocator_type::propagate_on_container_move_assignment::value &&
145a83710eSEric Fiselier // is_nothrow_move_assignable<allocator_type>::value);
155a83710eSEric Fiselier
165a83710eSEric Fiselier // This tests a conforming extension
175a83710eSEric Fiselier
1831cbe0f2SLouis Dionne // UNSUPPORTED: c++03
19f2f2a639SEric Fiselier
205a83710eSEric Fiselier #include <deque>
215a83710eSEric Fiselier #include <cassert>
225a83710eSEric Fiselier
23249b03efSEric Fiselier #include "test_macros.h"
24949389c3SMarshall Clow #include "MoveOnly.h"
255a83710eSEric Fiselier #include "test_allocator.h"
265a83710eSEric Fiselier
275a83710eSEric Fiselier template <class T>
285a83710eSEric Fiselier struct some_alloc
295a83710eSEric Fiselier {
305a83710eSEric Fiselier typedef T value_type;
315a83710eSEric Fiselier some_alloc(const some_alloc&);
32*7da4ee6fSKonstantin Varlamov void allocate(size_t);
335a83710eSEric Fiselier };
345a83710eSEric Fiselier
main(int,char **)352df59c50SJF Bastien int main(int, char**)
365a83710eSEric Fiselier {
375a83710eSEric Fiselier {
385a83710eSEric Fiselier typedef std::deque<MoveOnly> C;
395a83710eSEric Fiselier static_assert(std::is_nothrow_move_assignable<C>::value, "");
405a83710eSEric Fiselier }
415a83710eSEric Fiselier {
425a83710eSEric Fiselier typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
435a83710eSEric Fiselier static_assert(!std::is_nothrow_move_assignable<C>::value, "");
445a83710eSEric Fiselier }
4503fe6e2dSStephan T. Lavavej #if defined(_LIBCPP_VERSION)
465a83710eSEric Fiselier {
475a83710eSEric Fiselier typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
4803fe6e2dSStephan T. Lavavej static_assert(std::is_nothrow_move_assignable<C>::value, "");
495a83710eSEric Fiselier }
505a83710eSEric Fiselier {
515a83710eSEric Fiselier typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
5203fe6e2dSStephan T. Lavavej static_assert(!std::is_nothrow_move_assignable<C>::value, "");
535a83710eSEric Fiselier }
5403fe6e2dSStephan T. Lavavej #endif // _LIBCPP_VERSION
552df59c50SJF Bastien
562df59c50SJF Bastien return 0;
575a83710eSEric Fiselier }
58