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