1 //===----------------------------------------------------------------------===//
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 // UNSUPPORTED: c++98, c++03
10
11 // <vector>
12
13 // vector<bool>()
14 // noexcept(is_nothrow_default_constructible<allocator_type>::value);
15
16 // This tests a conforming extension
17 // For vector<>, this was added to the standard by N4258,
18 // but vector<bool> was not changed.
19
20
21 #include <vector>
22 #include <cassert>
23
24 #include "test_macros.h"
25 #include "test_allocator.h"
26
27 template <class T>
28 struct some_alloc
29 {
30 typedef T value_type;
31 some_alloc(const some_alloc&);
32 };
33
main()34 int main()
35 {
36 #if defined(_LIBCPP_VERSION)
37 {
38 typedef std::vector<bool> C;
39 static_assert(std::is_nothrow_default_constructible<C>::value, "");
40 }
41 {
42 typedef std::vector<bool, test_allocator<bool>> C;
43 static_assert(std::is_nothrow_default_constructible<C>::value, "");
44 }
45 {
46 typedef std::vector<bool, other_allocator<bool>> C;
47 static_assert(!std::is_nothrow_default_constructible<C>::value, "");
48 }
49 {
50 typedef std::vector<bool, some_alloc<bool>> C;
51 static_assert(!std::is_nothrow_default_constructible<C>::value, "");
52 }
53 #endif // _LIBCPP_VERSION
54 }
55