1 // -*- C++ -*-
2 //===------------------------------ span ---------------------------------===//
3 //
4 // The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===---------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
11
12 // <span>
13
14 // template <class ElementType, ptrdiff_t Extent>
15 // span<byte,
16 // Extent == dynamic_extent
17 // ? dynamic_extent
18 // : static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent>
19 // as_writeable_bytes(span<ElementType, Extent> s) noexcept;
20
21
22 #include <span>
23 #include <cassert>
24 #include <string>
25
26 #include "test_macros.h"
27
28 const int iArr2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
29
30 struct A {};
31
main()32 int main ()
33 {
34 std::as_writeable_bytes(std::span<const int>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
35 std::as_writeable_bytes(std::span<const long>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
36 std::as_writeable_bytes(std::span<const double>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
37 std::as_writeable_bytes(std::span<const A>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
38 std::as_writeable_bytes(std::span<const std::string>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
39
40 std::as_writeable_bytes(std::span<const int, 0>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
41 std::as_writeable_bytes(std::span<const long, 0>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
42 std::as_writeable_bytes(std::span<const double, 0>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
43 std::as_writeable_bytes(std::span<const A, 0>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
44 std::as_writeable_bytes(std::span<const std::string, 0>()); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
45
46 std::as_writeable_bytes(std::span<const int> (iArr2, 1)); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
47 std::as_writeable_bytes(std::span<const int, 1>(iArr2 + 5, 1)); // expected-error {{no matching function for call to 'as_writeable_bytes'}}
48 }
49