| 1 | // Copyright (C) 2021-2025 Free Software Foundation, Inc. |
| 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-do compile { target c++20 } } |
| 19 | |
| 20 | // Verify P2367 changes. |
| 21 | |
| 22 | #include <ranges> |
| 23 | |
| 24 | namespace ranges = std::ranges; |
| 25 | namespace views = std::views; |
| 26 | |
| 27 | void |
| 28 | test01() |
| 29 | { |
| 30 | extern int (&x)[5]; |
| 31 | |
| 32 | // Verify changes to views::single. |
| 33 | using ranges::single_view; |
| 34 | using std::same_as; |
| 35 | same_as<single_view<int*>> auto v1 = views::single(x); |
| 36 | same_as<single_view<int>> auto v2 = views::single((const int)5); |
| 37 | same_as<single_view<single_view<int>>> auto v3 = views::single(v2); |
| 38 | |
| 39 | // Verify changes to views::take. |
| 40 | auto v4 = views::take(x, 0ull); |
| 41 | |
| 42 | // Verify changes to views::drop. |
| 43 | auto v5 = views::drop(x, 0ull); |
| 44 | |
| 45 | // Verify changes to views::lazy_split. |
| 46 | auto v6 = views::lazy_split(x, 5u); |
| 47 | auto v7 = views::split(x, 5u); |
| 48 | } |