xref: /llvm-project/libcxx/test/std/ranges/range.req/range.range/range.compile.pass.cpp (revision d8fad6614923eea684f736e7d22fe54d5393f13f)
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 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: libcpp-no-concepts
11 // UNSUPPORTED: gcc-10
12 
13 // template<class T>
14 // concept range;
15 
16 #include <ranges>
17 
18 #include <vector>
19 
20 #include "test_range.h"
21 
22 namespace stdr = std::ranges;
23 
24 static_assert(stdr::range<test_range<cpp20_input_iterator> >);
25 
26 struct incompatible_iterators {
27   int* begin();
28   long* end();
29 };
30 static_assert(!stdr::range<incompatible_iterators>);
31 
32 struct int_begin_int_end {
33   int begin();
34   int end();
35 };
36 static_assert(!stdr::range<int_begin_int_end>);
37 
38 struct iterator_begin_int_end {
39   int* begin();
40   int end();
41 };
42 static_assert(!stdr::range<iterator_begin_int_end>);
43 
44 struct int_begin_iterator_end {
45   int begin();
46   int* end();
47 };
48 static_assert(!stdr::range<int_begin_iterator_end>);
49