// Copyright (C) 2019-2022 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// .
// { dg-options "-std=gnu++2a" }
// { dg-do compile { target c++2a } }
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static_assert(std::ranges::view>);
static_assert(std::ranges::view>);
static_assert(std::ranges::view>); // Changed with P2325R3
static_assert(std::ranges::view);
static_assert(std::ranges::view);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view>);
static_assert(!std::ranges::view);
// const test_random_access_range is not a range:
static_assert(!std::ranges::view<__gnu_test::test_random_access_range>);
template
struct test_view
: __gnu_test::test_random_access_range, std::ranges::view_base
{ };
static_assert(std::ranges::view>);
template<>
constexpr bool std::ranges::enable_view> = false;
static_assert(!std::ranges::view>);
void
test01()
{
// Verify LWG 3549 changes to ranges::enable_view.
using std::ranges::view_interface;
struct v1
: __gnu_test::test_random_access_range, view_interface { };
static_assert(!std::derived_from);
static_assert(std::ranges::enable_view);
struct v2 : v1, view_interface { };
static_assert(!std::derived_from);
static_assert(!std::ranges::enable_view);
struct v3 : __gnu_test::test_random_access_range { };
static_assert(!std::derived_from);
static_assert(!std::ranges::enable_view);
struct v4 { };
static_assert(!std::ranges::enable_view>);
}