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