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 _Tp> 13 // inline constexpr empty_view<_Tp> empty{}; 14 15 #include <ranges> 16 #include <cassert> 17 18 #include "test_macros.h" 19 20 template <class T> testType()21constexpr void testType() { 22 ASSERT_SAME_TYPE(decltype(std::views::empty<T>), const std::ranges::empty_view<T>); 23 ASSERT_SAME_TYPE(decltype((std::views::empty<T>)), const std::ranges::empty_view<T>&); 24 25 auto v = std::views::empty<T>; 26 assert(std::ranges::empty(v)); 27 } 28 29 struct Empty {}; 30 struct BigType { 31 char buff[8]; 32 }; 33 test()34constexpr bool test() { 35 36 testType<int>(); 37 testType<const int>(); 38 testType<int*>(); 39 testType<Empty>(); 40 testType<const Empty>(); 41 testType<BigType>(); 42 43 return true; 44 } 45 main(int,char **)46int main(int, char**) { 47 test(); 48 static_assert(test()); 49 50 return 0; 51 } 52