[flang] [unittests] Link to libMLIR in optimizer tests (#123476)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector / vector.cons / move_noexcept.pass.cpp
blobc2bfa5234065d8d70a8c51d71fe026dffd7c2ef3
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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <vector>
11 // vector(vector&&)
12 // noexcept(is_nothrow_move_constructible<allocator_type>::value);
14 // This tests a conforming extension
16 // UNSUPPORTED: c++03
18 #include <vector>
19 #include <cassert>
21 #include "test_macros.h"
22 #include "MoveOnly.h"
23 #include "test_allocator.h"
25 template <class T>
26 struct some_alloc
28 typedef T value_type;
29 some_alloc(const some_alloc&);
30 void allocate(std::size_t);
33 int main(int, char**)
36 typedef std::vector<MoveOnly> C;
37 static_assert(std::is_nothrow_move_constructible<C>::value, "");
40 typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
41 static_assert(std::is_nothrow_move_constructible<C>::value, "");
44 typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
45 static_assert(std::is_nothrow_move_constructible<C>::value, "");
48 typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
49 // In C++17, move constructors for allocators are not allowed to throw
50 #if TEST_STD_VER > 14
51 static_assert( std::is_nothrow_move_constructible<C>::value, "");
52 #else
53 static_assert(!std::is_nothrow_move_constructible<C>::value, "");
54 #endif
57 return 0;