1 // Copyright (C) 2001, 2004 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 2, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING. If not, write to the Free
16 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // 23.2.2.1 list constructors, copy, and assignment
22 #include <testsuite_hooks.h>
24 bool test
__attribute__((unused
)) = true;
30 // Another nontrivial type
33 // A nontrivial type convertible from an int
36 bool operator==(const C
& rhs
) { return i_
== rhs
.i_
; }
42 // This test verifies the following.
43 // 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
44 // 23.2.2 const_iterator begin() const
45 // 23.2.2 const_iterator end() const
46 // 23.2.2 size_type size() const
51 const std::size_t LIST_SIZE
= 5;
52 const int INIT_VALUE
= 7;
54 std::list
<int>::const_iterator i
;
56 // nontrivial value_type
57 std::list
< A
<B
> > list0201(LIST_SIZE
);
60 std::list
<int> list0202(LIST_SIZE
);
61 for (i
= list0202
.begin(), count
= 0;
65 VERIFY(count
== LIST_SIZE
);
66 VERIFY(list0202
.size() == LIST_SIZE
);
69 std::list
<int> list0203(LIST_SIZE
, INIT_VALUE
);
70 for (i
= list0203
.begin(), count
= 0;
73 VERIFY(*i
== INIT_VALUE
);
74 VERIFY(count
== LIST_SIZE
);
75 VERIFY(list0203
.size() == LIST_SIZE
);
78 #if !__GXX_WEAK__ && _MT_ALLOCATOR_H
79 // Explicitly instantiate for systems with no COMDAT or weak support.
80 template class __gnu_cxx::__mt_alloc
<std::_List_node
<A
<B
> > >;
81 template class __gnu_cxx::__mt_alloc
<int>;
82 template class __gnu_cxx::__mt_alloc
<std::_List_node
<int> >;