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-has-no-incomplete-ranges 11 12 // template<class T> 13 // concept range; 14 15 #include <ranges> 16 17 #include <vector> 18 19 #include "test_range.h" 20 21 22 23 static_assert(std::ranges::range<test_range<cpp20_input_iterator> >); 24 25 struct incompatible_iterators { 26 int* begin(); 27 long* end(); 28 }; 29 static_assert(!std::ranges::range<incompatible_iterators>); 30 31 struct int_begin_int_end { 32 int begin(); 33 int end(); 34 }; 35 static_assert(!std::ranges::range<int_begin_int_end>); 36 37 struct iterator_begin_int_end { 38 int* begin(); 39 int end(); 40 }; 41 static_assert(!std::ranges::range<iterator_begin_int_end>); 42 43 struct int_begin_iterator_end { 44 int begin(); 45 int* end(); 46 }; 47 static_assert(!std::ranges::range<int_begin_iterator_end>); 48 49 // Test ADL-proofing. 50 struct Incomplete; 51 template<class T> struct Holder { T t; }; 52 static_assert(!std::ranges::range<Holder<Incomplete>*>); 53