blob: 9347b8329ae3b8081eca4eb88cc34c549f7cd64d [file] [log] [blame]
Howard Hinnant7686add2011-06-04 14:31:57 +00001//===----------------------------------------------------------------------===//
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(map&&)
13// noexcept(is_nothrow_move_constructible<allocator_type>::value &&
14// is_nothrow_move_constructible<key_compare>::value);
15
16// This tests a conforming extension
17
18#include <map>
19#include <cassert>
20
Marshall Clowdf00d5e2015-01-28 21:22:53 +000021#include "MoveOnly.h"
Marshall Clow1b921882013-12-03 00:18:10 +000022#include "test_allocator.h"
Howard Hinnant7686add2011-06-04 14:31:57 +000023
24template <class T>
25struct some_comp
26{
27 typedef T value_type;
28 some_comp(const some_comp&);
29};
30
31int main()
32{
33#if __has_feature(cxx_noexcept)
34 {
35 typedef std::map<MoveOnly, MoveOnly> C;
36 static_assert(std::is_nothrow_move_constructible<C>::value, "");
37 }
38 {
Dan Albert1d4a1ed2016-05-25 22:36:09 -070039 typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
Howard Hinnant7686add2011-06-04 14:31:57 +000040 static_assert(std::is_nothrow_move_constructible<C>::value, "");
41 }
42 {
Dan Albert1d4a1ed2016-05-25 22:36:09 -070043 typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
Howard Hinnant7686add2011-06-04 14:31:57 +000044 static_assert(std::is_nothrow_move_constructible<C>::value, "");
45 }
46 {
47 typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
48 static_assert(!std::is_nothrow_move_constructible<C>::value, "");
49 }
50#endif
51}