1a8cf78c7SLouis Dionne //===----------------------------------------------------------------------===//
2a8cf78c7SLouis Dionne //
3a8cf78c7SLouis Dionne // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4a8cf78c7SLouis Dionne // See https://llvm.org/LICENSE.txt for license information.
5a8cf78c7SLouis Dionne // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6a8cf78c7SLouis Dionne //
7a8cf78c7SLouis Dionne //===----------------------------------------------------------------------===//
8a8cf78c7SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17
9a8cf78c7SLouis Dionne
10a8cf78c7SLouis Dionne // <span>
11a8cf78c7SLouis Dionne
12a8cf78c7SLouis Dionne // template <class ElementType, size_t Extent>
13a8cf78c7SLouis Dionne // span<byte,
14a8cf78c7SLouis Dionne // Extent == dynamic_extent
15a8cf78c7SLouis Dionne // ? dynamic_extent
16a8cf78c7SLouis Dionne // : sizeof(ElementType) * Extent>
17a8cf78c7SLouis Dionne // as_writable_bytes(span<ElementType, Extent> s) noexcept;
18a8cf78c7SLouis Dionne
19a8cf78c7SLouis Dionne #include <span>
20a8cf78c7SLouis Dionne #include <string>
21a8cf78c7SLouis Dionne
22a8cf78c7SLouis Dionne #include "test_macros.h"
23a8cf78c7SLouis Dionne
24a8cf78c7SLouis Dionne const int iArr2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
25a8cf78c7SLouis Dionne
26a8cf78c7SLouis Dionne struct A {};
27a8cf78c7SLouis Dionne
f()28a8cf78c7SLouis Dionne void f() {
29a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const int>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
30a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const long>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
31a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const double>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
32a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const A>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
33a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const std::string>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
34a8cf78c7SLouis Dionne
35a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const int, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
36a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const long, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
37a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const double, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
38a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const A, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
39*fb855eb9SMark de Wever std::as_writable_bytes(std::span<const std::string, (std::size_t)0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
40a8cf78c7SLouis Dionne
41a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const int> (iArr2, 1)); // expected-error {{no matching function for call to 'as_writable_bytes'}}
42a8cf78c7SLouis Dionne std::as_writable_bytes(std::span<const int, 1>(iArr2 + 5, 1)); // expected-error {{no matching function for call to 'as_writable_bytes'}}
43a8cf78c7SLouis Dionne }
44