]>
Commit | Line | Data |
---|---|---|
3a63c9cd ESR |
1 | // { dg-options "-std=gnu++0x" } |
2 | ||
748086b7 | 3 | // Copyright (C) 2008, 2009 Free Software Foundation, Inc. |
3a63c9cd ESR |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
748086b7 | 8 | // Free Software Foundation; either version 3, or (at your option) |
3a63c9cd ESR |
9 | // any later version. |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without Pred the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
17 | // with this library; see the file COPYING3. If not see |
18 | // <http://www.gnu.org/licenses/>. | |
3a63c9cd ESR |
19 | |
20 | // 23.2.3.n forward_list xxx [lib.forward_list.xxx] | |
21 | ||
22 | #include <forward_list> | |
23 | #include <testsuite_hooks.h> | |
24 | ||
25 | bool test __attribute__((unused)) = true; | |
26 | ||
27 | // A nontrivial type. | |
28 | template<typename T> | |
29 | struct A { }; | |
30 | ||
31 | // Another nontrivial type | |
32 | struct B { }; | |
33 | ||
34 | // A nontrivial type convertible from an int | |
35 | struct C | |
36 | { | |
37 | C(int i) : i_(i) { } | |
38 | bool operator==(const C& rhs) { return i_ == rhs.i_; } | |
39 | int i_; | |
40 | }; | |
41 | ||
42 | // This test verifies the following. | |
43 | // | |
44 | void | |
45 | test01() | |
46 | { | |
47 | std::forward_list< A<B> > lst; | |
48 | VERIFY(lst.begin() == lst.end()); | |
49 | VERIFY(std::distance(lst.begin(), lst.end()) == 0); | |
50 | ||
51 | // check type definitions -- will fail compile if missing | |
52 | typedef std::forward_list< A<B> >::reference reference; | |
53 | typedef std::forward_list< A<B> >::const_reference const_reference; | |
54 | typedef std::forward_list< A<B> >::iterator iterator; | |
55 | typedef std::forward_list< A<B> >::const_iterator const_iterator; | |
56 | typedef std::forward_list< A<B> >::size_type size_type; | |
57 | typedef std::forward_list< A<B> >::difference_type difference_type; | |
58 | typedef std::forward_list< A<B> >::value_type value_type; | |
59 | typedef std::forward_list< A<B> >::allocator_type allocator_type; | |
60 | typedef std::forward_list< A<B> >::pointer pointer; | |
61 | typedef std::forward_list< A<B> >::const_pointer const_pointer; | |
62 | } | |
63 | ||
64 | int | |
65 | main() | |
66 | { | |
67 | test01(); | |
68 | return 0; | |
69 | } |