[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / views / span.sub / first.fail.cpp
blobb51196cb02789b66ba06ae47422a53e0c2223c67
1 // -*- C++ -*-
2 //===------------------------------ span ---------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===---------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // <span>
13 // template<size_t Count>
14 // constexpr span<element_type, Count> first() const;
16 // constexpr span<element_type, dynamic_extent> first(size_type count) const;
18 // Requires: Count <= size().
20 #include <span>
22 #include "test_macros.h"
24 constexpr int carr[] = {1, 2, 3, 4};
26 int main(int, char**) {
27 std::span<const int, 4> sp(carr);
29 // Count too large
31 [[maybe_unused]] auto s1 = sp.first<5>(); // expected-error-re@span:* {{static_assert failed{{( due to requirement '.*')?}} "Count out of range in span::first()"}}
34 // Count numeric_limits
36 [[maybe_unused]] auto s1 = sp.first<std::size_t(-1)>(); // expected-error-re@span:* {{static_assert failed{{( due to requirement '.*')?}} "Count out of range in span::first()"}}
39 return 0;