[flang] [unittests] Link to libMLIR in optimizer tests (#123476)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector / vector.cons / default_noexcept.pass.cpp
blob054ea6430f82a737fd635f6dab38cd1b64993357
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 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03
10 // <vector>
12 // vector()
13 // noexcept(is_nothrow_default_constructible<allocator_type>::value);
15 // This *was* a conforming extension, but it was adopted in N4258.
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 TEST_CONSTEXPR_CXX20 bool tests() {
35 typedef std::vector<MoveOnly> C;
36 static_assert(std::is_nothrow_default_constructible<C>::value, "");
39 typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
40 static_assert(std::is_nothrow_default_constructible<C>::value, "");
43 typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
44 static_assert(!std::is_nothrow_default_constructible<C>::value, "");
47 typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
48 static_assert(!std::is_nothrow_default_constructible<C>::value, "");
51 return true;
54 int main(int, char**)
56 tests();
57 #if TEST_STD_VER > 17
58 static_assert(tests());
59 #endif
60 return 0;