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// UNSUPPORTED: c++03, c++11, c++14, c++17
9
10// <span>
11
12// template <class It, class End>
13// constexpr explicit(Extent != dynamic_extent) span(It first, End last);
14// Requires: [first, last) shall be a valid range.
15// If Extent is not equal to dynamic_extent, then last - first shall be equal to Extent.
16//
17
18#include <span>
19#include <iterator>
20
21template<class T, std::size_t Extent>
22std::span<T, Extent> createImplicitSpan(T* first, T* last) {
23 return {first, last}; // expected-error {{chosen constructor is explicit in copy-initialization}}
24}
25
26void f() {
27 // explicit constructor necessary
28 int arr[] = {1, 2, 3};
29 createImplicitSpan<int, 1>(std::begin(arr&: arr), std::end(arr&: arr));
30}
31

source code of libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp