Eric Fiselier | de637db | 2016-01-27 00:11:54 +0000 | [diff] [blame] | 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 | |
| 10 | // <forward_list> |
| 11 | |
| 12 | // forward_list() |
| 13 | // forward_list::iterator() |
| 14 | // forward_list::const_iterator() |
| 15 | |
| 16 | #include <forward_list> |
| 17 | #include <cassert> |
| 18 | |
| 19 | #include "test_macros.h" |
| 20 | #include "min_allocator.h" |
| 21 | |
| 22 | struct A { |
| 23 | std::forward_list<A> d; |
| 24 | std::forward_list<A>::iterator it; |
| 25 | std::forward_list<A>::const_iterator it2; |
| 26 | }; |
| 27 | |
| 28 | #if TEST_STD_VER >= 11 |
| 29 | struct B { |
| 30 | typedef std::forward_list<B, min_allocator<B>> FList; |
| 31 | FList d; |
| 32 | FList::iterator it; |
| 33 | FList::const_iterator it2; |
| 34 | }; |
| 35 | #endif |
| 36 | |
| 37 | int main() |
| 38 | { |
| 39 | { |
| 40 | A a; |
| 41 | assert(a.d.empty()); |
| 42 | a.it = a.d.begin(); |
| 43 | a.it2 = a.d.cbefore_begin(); |
| 44 | } |
| 45 | #if TEST_STD_VER >= 11 |
| 46 | { |
| 47 | B b; |
| 48 | assert(b.d.empty()); |
| 49 | b.it = b.d.begin(); |
| 50 | b.it2 = b.d.cbefore_begin(); |
| 51 | } |
| 52 | #endif |
| 53 | } |