]>
Commit | Line | Data |
---|---|---|
99dee823 | 1 | // Copyright (C) 2020-2021 Free Software Foundation, Inc. |
9d908b7f JW |
2 | // |
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 3, or (at your option) | |
7 | // any later version. | |
8 | ||
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. | |
13 | ||
14 | // You should have received a copy of the GNU General Public License along | |
15 | // with this library; see the file COPYING3. If not see | |
16 | // <http://www.gnu.org/licenses/>. | |
17 | ||
18 | // { dg-options "-std=gnu++2a" } | |
19 | // { dg-do compile { target c++2a } } | |
20 | ||
21 | #include <iterator> | |
22 | ||
23 | struct bidi_iterator | |
24 | { | |
25 | // No nested reference and pointer types. | |
26 | // No iterator_category. | |
27 | ||
28 | // cpp17-iterator requirements: | |
29 | int& operator*() const; | |
30 | bidi_iterator& operator++(); | |
31 | bidi_iterator operator++(int); | |
32 | ||
33 | // cpp17-input-iterator requirements: | |
34 | friend bool operator==(const bidi_iterator&, const bidi_iterator&); | |
35 | using difference_type = long long; | |
36 | using value_type = int; | |
37 | ||
38 | // cpp17-forward-iterator requirements: | |
39 | bidi_iterator(); | |
40 | ||
41 | // cpp17-bidirectional-iterator requirements: | |
42 | bidi_iterator& operator--(); | |
43 | bidi_iterator operator--(int); | |
44 | }; | |
45 | ||
46 | void | |
47 | test01() | |
48 | { | |
49 | // PR libstdc++/97935 | |
50 | // Missing subsumption in iterator category detection | |
51 | using namespace std; | |
52 | static_assert(__detail::__cpp17_bidi_iterator<bidi_iterator>); | |
53 | static_assert(same_as<iterator_traits<bidi_iterator>::iterator_category, | |
54 | bidirectional_iterator_tag>, | |
55 | "PR libstdc++/97935"); | |
56 | } |