15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier
95a83710eSEric Fiselier // <list>
105a83710eSEric Fiselier
115a83710eSEric Fiselier // list(const list& c);
125a83710eSEric Fiselier
135a83710eSEric Fiselier #include <list>
145a83710eSEric Fiselier #include <cassert>
1554613ab4SEric Fiselier
1654613ab4SEric Fiselier #include "test_macros.h"
175a83710eSEric Fiselier #include "DefaultOnly.h"
185a83710eSEric Fiselier #include "test_allocator.h"
195a83710eSEric Fiselier #include "min_allocator.h"
205a83710eSEric Fiselier
main(int,char **)21*2df59c50SJF Bastien int main(int, char**)
225a83710eSEric Fiselier {
235a83710eSEric Fiselier {
245a83710eSEric Fiselier std::list<int> l(3, 2);
255a83710eSEric Fiselier std::list<int> l2 = l;
265a83710eSEric Fiselier assert(l2 == l);
275a83710eSEric Fiselier }
285a83710eSEric Fiselier {
295a83710eSEric Fiselier std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
305a83710eSEric Fiselier std::list<int, test_allocator<int> > l2 = l;
315a83710eSEric Fiselier assert(l2 == l);
325a83710eSEric Fiselier assert(l2.get_allocator() == l.get_allocator());
335a83710eSEric Fiselier }
3454613ab4SEric Fiselier #if TEST_STD_VER >= 11
355a83710eSEric Fiselier {
365a83710eSEric Fiselier std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
375a83710eSEric Fiselier std::list<int, other_allocator<int> > l2 = l;
385a83710eSEric Fiselier assert(l2 == l);
395a83710eSEric Fiselier assert(l2.get_allocator() == other_allocator<int>(-2));
405a83710eSEric Fiselier }
415a83710eSEric Fiselier {
425a83710eSEric Fiselier std::list<int, min_allocator<int>> l(3, 2);
435a83710eSEric Fiselier std::list<int, min_allocator<int>> l2 = l;
445a83710eSEric Fiselier assert(l2 == l);
455a83710eSEric Fiselier }
465a83710eSEric Fiselier {
475a83710eSEric Fiselier std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
485a83710eSEric Fiselier std::list<int, min_allocator<int> > l2 = l;
495a83710eSEric Fiselier assert(l2 == l);
505a83710eSEric Fiselier assert(l2.get_allocator() == l.get_allocator());
515a83710eSEric Fiselier }
525a83710eSEric Fiselier #endif
53*2df59c50SJF Bastien
54*2df59c50SJF Bastien return 0;
555a83710eSEric Fiselier }
56