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 // std::ranges::begin 13 14 #include <ranges> 15 16 struct NonBorrowedRange { 17 int* begin() const; 18 int* end() const; 19 }; 20 static_assert(!std::ranges::enable_borrowed_range<NonBorrowedRange>); 21 22 // Verify that if the expression is an rvalue and `enable_borrowed_range` is false, `ranges::begin` is ill-formed. 23 void test() { 24 std::ranges::begin(NonBorrowedRange()); 25 // expected-error-re@-1 {{{{call to deleted function call operator in type 'const (std::ranges::)?__begin::__fn'}}}} 26 // expected-error@-2 {{attempt to use a deleted function}} 27 } 28