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 // <map>
105a83710eSEric Fiselier
115a83710eSEric Fiselier // multimap& operator=(multimap&& 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 // is_nothrow_move_assignable<key_compare>::value);
165a83710eSEric Fiselier
175a83710eSEric Fiselier // This tests a conforming extension
185a83710eSEric Fiselier
19*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03
20f2f2a639SEric Fiselier
215a83710eSEric Fiselier #include <map>
225a83710eSEric Fiselier #include <cassert>
235a83710eSEric Fiselier
24249b03efSEric Fiselier #include "test_macros.h"
25949389c3SMarshall Clow #include "MoveOnly.h"
265a83710eSEric Fiselier #include "test_allocator.h"
275a83710eSEric Fiselier
285a83710eSEric Fiselier template <class T>
295a83710eSEric Fiselier struct some_comp
305a83710eSEric Fiselier {
315a83710eSEric Fiselier typedef T value_type;
325a83710eSEric Fiselier some_comp& operator=(const some_comp&);
operator ()some_comp3354238fd3SMarshall Clow bool operator()(const T&, const T&) const { return false; }
345a83710eSEric Fiselier };
355a83710eSEric Fiselier
main(int,char **)362df59c50SJF Bastien int main(int, char**)
375a83710eSEric Fiselier {
38e0312a30SMarshall Clow typedef std::pair<const MoveOnly, MoveOnly> V;
395a83710eSEric Fiselier {
405a83710eSEric Fiselier typedef std::multimap<MoveOnly, MoveOnly> C;
415a83710eSEric Fiselier static_assert(std::is_nothrow_move_assignable<C>::value, "");
425a83710eSEric Fiselier }
435a83710eSEric Fiselier {
44e0312a30SMarshall Clow typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
455a83710eSEric Fiselier static_assert(!std::is_nothrow_move_assignable<C>::value, "");
465a83710eSEric Fiselier }
4703fe6e2dSStephan T. Lavavej #if defined(_LIBCPP_VERSION)
485a83710eSEric Fiselier {
49e0312a30SMarshall Clow typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
5003fe6e2dSStephan T. Lavavej static_assert(std::is_nothrow_move_assignable<C>::value, "");
515a83710eSEric Fiselier }
5203fe6e2dSStephan T. Lavavej #endif // _LIBCPP_VERSION
535a83710eSEric Fiselier {
545a83710eSEric Fiselier typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
555a83710eSEric Fiselier static_assert(!std::is_nothrow_move_assignable<C>::value, "");
565a83710eSEric Fiselier }
572df59c50SJF Bastien
582df59c50SJF Bastien return 0;
595a83710eSEric Fiselier }
60