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
9// <deque>
10
11// explicit deque(const allocator_type& a);
12
13#include "asan_testing.h"
14#include <deque>
15#include <cassert>
16
17#include "test_macros.h"
18#include "test_allocator.h"
19#include "../../../NotConstructible.h"
20#include "min_allocator.h"
21
22template <class T, class Allocator>
23void
24test(const Allocator& a)
25{
26 std::deque<T, Allocator> d(a);
27 assert(d.size() == 0);
28 assert(d.get_allocator() == a);
29 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
30}
31
32int main(int, char**)
33{
34 test<int>(std::allocator<int>());
35 test<NotConstructible>(test_allocator<NotConstructible>(3));
36#if TEST_STD_VER >= 11
37 test<int>(min_allocator<int>());
38 test<int>(safe_allocator<int>());
39 test<NotConstructible>(min_allocator<NotConstructible>{});
40 test<NotConstructible>(safe_allocator<NotConstructible>{});
41 test<int>(explicit_allocator<int>());
42 test<NotConstructible>(explicit_allocator<NotConstructible>{});
43#endif
44
45 return 0;
46}
47

source code of libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp